From cc8f978b3b4007975f7a6f2a9a43dd5bc5f8ec4b Mon Sep 17 00:00:00 2001 From: Patrick Thomson Date: Mon, 23 Nov 2020 12:05:32 -0500 Subject: [PATCH] inline this lambda --- cli/src/query_testing.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cli/src/query_testing.rs b/cli/src/query_testing.rs index 2a9a8c2d..ef02ec69 100644 --- a/cli/src/query_testing.rs +++ b/cli/src/query_testing.rs @@ -135,11 +135,9 @@ pub fn assert_expected_captures( let contents = fs::read_to_string(path)?; let pairs = parse_position_comments(parser, language, contents.as_bytes())?; for info in &infos { - let found = pairs.iter().find(|p| { + if let Some(found) = pairs.iter().find(|p| { p.position.row == info.start.row && p.position >= info.start && p.position < info.end - }); - - if let Some(found) = found { + }) { if found.expected_capture_name != info.name && info.name != "name" { Err(error::Error::new(format!( "Assertion failed: at {}, found {}, expected {}",