diff options
| author | Duncan Proctor <duncpro@icloud.com> | 2024-10-22 03:19:47 -0400 |
|---|---|---|
| committer | Duncan Proctor <duncpro@icloud.com> | 2024-10-22 03:19:47 -0400 |
| commit | b76391332969741c601619238204d9557f7d29ac (patch) | |
| tree | 5664b9eb20cd23de1faef0dfdedb1cf03b8795f3 | |
| parent | 88b9b9d5dab1ecd3038149d80c8e75fe3302084a (diff) | |
| download | rust-b76391332969741c601619238204d9557f7d29ac.tar.gz rust-b76391332969741c601619238204d9557f7d29ac.zip | |
tidy
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs | 2 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide/src/goto_definition.rs | 40 |
2 files changed, 27 insertions, 15 deletions
diff --git a/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs b/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs index e95041b923f..be0e57b0b1d 100644 --- a/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs +++ b/src/tools/rust-analyzer/crates/hir/src/source_analyzer.rs @@ -363,7 +363,7 @@ impl SourceAnalyzer { // [E0586] inclusive ranges must be bounded at the end (RangeOp::Inclusive, None, None) => return None, - (RangeOp::Inclusive, Some(_), None) => return None + (RangeOp::Inclusive, Some(_), None) => return None, }; self.resolver.resolve_known_struct(db.upcast(), &path) } diff --git a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs index c532e259355..5c9ca0bc89a 100644 --- a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs +++ b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs @@ -453,71 +453,83 @@ mod tests { let (analysis, position, _) = fixture::annotations(ra_fixture); let navs = analysis.goto_definition(position).unwrap().expect("no definition found").info; assert!(navs.len() < 2, "expected single navigation target but encountered {}", navs.len()); - let Some(target) = navs.into_iter().next() else { - panic!("expected single navigation target but encountered none"); + let Some(target) = navs.into_iter().next() else { + panic!("expected single navigation target but encountered none"); }; assert_eq!(target.name, SmolStr::new_inline(expected_name)); } #[test] fn goto_def_range() { - check_name("Range", r#" + check_name( + "Range", + r#" //- minicore: range let x = 0.$0.1; -"# +"#, ); } #[test] fn goto_def_range_from() { - check_name("RangeFrom", r#" + check_name( + "RangeFrom", + r#" //- minicore: range fn f(arr: &[i32]) -> &[i32] { &arr[0.$0.] } -"# +"#, ); } #[test] fn goto_def_range_inclusive() { - check_name("RangeInclusive", r#" + check_name( + "RangeInclusive", + r#" //- minicore: range let x = 0.$0.=1; -"# +"#, ); } #[test] fn goto_def_range_full() { - check_name("RangeFull", r#" + check_name( + "RangeFull", + r#" //- minicore: range fn f(arr: &[i32]) -> &[i32] { &arr[.$0.] } -"# +"#, ); } #[test] fn goto_def_range_to() { - check_name("RangeTo", r#" + check_name( + "RangeTo", + r#" //- minicore: range fn f(arr: &[i32]) -> &[i32] { &arr[.$0.10] } -"# +"#, ); } #[test] fn goto_def_range_to_inclusive() { - check_name("RangeToInclusive", r#" + check_name( + "RangeToInclusive", + r#" //- minicore: range fn f(arr: &[i32]) -> &[i32] { &arr[.$0.=10] } -"# +"#, ); } |
