about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2021-12-07 15:42:54 +0100
committerLukas Wirth <lukastw97@gmail.com>2021-12-07 15:42:54 +0100
commitf781e599cc6376a3706498dcc9ce5e7ad59e16e1 (patch)
treeea9fc55450bfc777ec8319dd93240a3b8df10f60
parente09d410dcd927ab93e8c169160f196a34d317946 (diff)
downloadrust-f781e599cc6376a3706498dcc9ce5e7ad59e16e1.tar.gz
rust-f781e599cc6376a3706498dcc9ce5e7ad59e16e1.zip
Adjust incorrect runnable tests
-rw-r--r--crates/ide/src/navigation_target.rs6
-rw-r--r--crates/ide/src/runnables.rs2
2 files changed, 3 insertions, 5 deletions
diff --git a/crates/ide/src/navigation_target.rs b/crates/ide/src/navigation_target.rs
index 50799738d16..52e099513a5 100644
--- a/crates/ide/src/navigation_target.rs
+++ b/crates/ide/src/navigation_target.rs
@@ -298,7 +298,6 @@ impl TryToNav for hir::Impl {
         let InFile { file_id, value } = self.source(db)?;
         let derive_attr = self.is_builtin_derive(db);
 
-        let range = |syntax: &_| InFile::new(file_id, syntax).original_file_range(db);
         let focus_range = if derive_attr.is_some() {
             None
         } else {
@@ -307,9 +306,10 @@ impl TryToNav for hir::Impl {
                 .and_then(|ty| InFile::new(file_id, ty.syntax()).original_file_range_opt(db))
                 .map(|it| it.range)
         };
+
         let FileRange { file_id, range: full_range } = match &derive_attr {
-            Some(InFile { value, .. }) => range(value.syntax()),
-            None => range(value.syntax()),
+            Some(attr) => attr.syntax().original_file_range(db),
+            None => InFile::new(file_id, value.syntax()).original_file_range(db),
         };
 
         Some(NavigationTarget::from_syntax(
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs
index 3078789d123..67062654d6e 100644
--- a/crates/ide/src/runnables.rs
+++ b/crates/ide/src/runnables.rs
@@ -1437,7 +1437,6 @@ gen2!();
                                 0,
                             ),
                             full_range: 228..236,
-                            focus_range: 228..236,
                             name: "tests2",
                             kind: Module,
                             description: "mod tests2",
@@ -1522,7 +1521,6 @@ foo!();
                                 0,
                             ),
                             full_range: 210..217,
-                            focus_range: 210..217,
                             name: "foo_tests",
                             kind: Module,
                             description: "mod foo_tests",