diff options
Diffstat (limited to 'crates/ide/src/goto_definition.rs')
-rw-r--r-- | crates/ide/src/goto_definition.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 2d36c34e9..8dd643a0f 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs | |||
@@ -43,7 +43,7 @@ pub(crate) fn goto_definition( | |||
43 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; | 43 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; |
44 | let (_, link, ns) = | 44 | let (_, link, ns) = |
45 | extract_definitions_from_markdown(docs.as_str()).into_iter().find(|(range, ..)| { | 45 | extract_definitions_from_markdown(docs.as_str()).into_iter().find(|(range, ..)| { |
46 | doc_mapping.map(range.clone()).map_or(false, |InFile { file_id, value: range }| { | 46 | doc_mapping.map(*range).map_or(false, |InFile { file_id, value: range }| { |
47 | file_id == position.file_id.into() && range.contains(position.offset) | 47 | file_id == position.file_id.into() && range.contains(position.offset) |
48 | }) | 48 | }) |
49 | })?; | 49 | })?; |
@@ -57,7 +57,7 @@ pub(crate) fn goto_definition( | |||
57 | }, | 57 | }, |
58 | ast::Name(name) => { | 58 | ast::Name(name) => { |
59 | let def = NameClass::classify(&sema, &name)?.referenced_or_defined(sema.db); | 59 | let def = NameClass::classify(&sema, &name)?.referenced_or_defined(sema.db); |
60 | try_find_trait_item_definition(&sema.db, &def) | 60 | try_find_trait_item_definition(sema.db, &def) |
61 | .or_else(|| def.try_to_nav(sema.db)) | 61 | .or_else(|| def.try_to_nav(sema.db)) |
62 | }, | 62 | }, |
63 | ast::Lifetime(lt) => if let Some(name_class) = NameClass::classify_lifetime(&sema, <) { | 63 | ast::Lifetime(lt) => if let Some(name_class) = NameClass::classify_lifetime(&sema, <) { |
@@ -185,7 +185,7 @@ mod tests { | |||
185 | extern crate std$0; | 185 | extern crate std$0; |
186 | //- /std/lib.rs crate:std | 186 | //- /std/lib.rs crate:std |
187 | // empty | 187 | // empty |
188 | //^ file | 188 | //^file |
189 | "#, | 189 | "#, |
190 | ) | 190 | ) |
191 | } | 191 | } |
@@ -198,7 +198,7 @@ extern crate std$0; | |||
198 | extern crate std as abc$0; | 198 | extern crate std as abc$0; |
199 | //- /std/lib.rs crate:std | 199 | //- /std/lib.rs crate:std |
200 | // empty | 200 | // empty |
201 | //^ file | 201 | //^file |
202 | "#, | 202 | "#, |
203 | ) | 203 | ) |
204 | } | 204 | } |
@@ -253,7 +253,7 @@ mod $0foo; | |||
253 | 253 | ||
254 | //- /foo.rs | 254 | //- /foo.rs |
255 | // empty | 255 | // empty |
256 | //^ file | 256 | //^file |
257 | "#, | 257 | "#, |
258 | ); | 258 | ); |
259 | 259 | ||
@@ -264,7 +264,7 @@ mod $0foo; | |||
264 | 264 | ||
265 | //- /foo/mod.rs | 265 | //- /foo/mod.rs |
266 | // empty | 266 | // empty |
267 | //^ file | 267 | //^file |
268 | "#, | 268 | "#, |
269 | ); | 269 | ); |
270 | } | 270 | } |
@@ -395,7 +395,7 @@ use foo as bar$0; | |||
395 | 395 | ||
396 | //- /foo/lib.rs crate:foo | 396 | //- /foo/lib.rs crate:foo |
397 | // empty | 397 | // empty |
398 | //^ file | 398 | //^file |
399 | "#, | 399 | "#, |
400 | ); | 400 | ); |
401 | } | 401 | } |
@@ -1287,7 +1287,7 @@ fn main() { | |||
1287 | } | 1287 | } |
1288 | //- /foo.txt | 1288 | //- /foo.txt |
1289 | // empty | 1289 | // empty |
1290 | //^ file | 1290 | //^file |
1291 | "#, | 1291 | "#, |
1292 | ); | 1292 | ); |
1293 | } | 1293 | } |