Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/closure_captures.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/closure_captures.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir-ty/src/tests/closure_captures.rs b/crates/hir-ty/src/tests/closure_captures.rs index b01f44acbc..0a38635930 100644 --- a/crates/hir-ty/src/tests/closure_captures.rs +++ b/crates/hir-ty/src/tests/closure_captures.rs @@ -102,19 +102,19 @@ fn check_closure_captures(#[rust_analyzer::rust_fixture] ra_fixture: &str, expec // FIXME: Deduplicate this with hir::Local::sources(). let captured_local = capture.captured_local(); - let local_text_range = match body.self_param.zip(source_map.self_param_syntax()) + let local_text_range = if body.self_params.contains(&captured_local) + && let Some(source) = source_map.self_param_syntax() { - Some((param, source)) if param == captured_local => { - format!("{:?}", text_range(db, source)) - } - _ => source_map + format!("{:?}", text_range(db, source)) + } else { + source_map .patterns_for_binding(captured_local) .iter() .map(|&definition| { text_range(db, source_map.pat_syntax(definition).unwrap()) }) .map(|it| format!("{it:?}")) - .join(", "), + .join(", ") }; let place = display_place(db, body, &capture.place, captured_local); let capture_ty = capture |