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 {}",