diff options
Diffstat (limited to 'crates/ide/src/runnables.rs')
-rw-r--r-- | crates/ide/src/runnables.rs | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index bea020b06..5b488e2c5 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs | |||
@@ -7,17 +7,13 @@ use hir::{AsAssocItem, HasAttrs, HasSource, HirDisplay, Semantics}; | |||
7 | use ide_assists::utils::test_related_attribute; | 7 | use ide_assists::utils::test_related_attribute; |
8 | use ide_db::{ | 8 | use ide_db::{ |
9 | base_db::{FilePosition, FileRange}, | 9 | base_db::{FilePosition, FileRange}, |
10 | defs::Definition, | ||
11 | helpers::visit_file_defs, | 10 | helpers::visit_file_defs, |
12 | search::SearchScope, | 11 | search::SearchScope, |
13 | RootDatabase, SymbolKind, | 12 | RootDatabase, SymbolKind, |
14 | }; | 13 | }; |
15 | use itertools::Itertools; | 14 | use itertools::Itertools; |
16 | use rustc_hash::FxHashSet; | 15 | use rustc_hash::FxHashSet; |
17 | use syntax::{ | 16 | use syntax::ast::{self, AstNode, AttrsOwner}; |
18 | ast::{self, AstNode, AttrsOwner}, | ||
19 | match_ast, SyntaxNode, | ||
20 | }; | ||
21 | 17 | ||
22 | use crate::{ | 18 | use crate::{ |
23 | display::{ToNav, TryToNav}, | 19 | display::{ToNav, TryToNav}, |
@@ -271,28 +267,6 @@ pub(crate) fn runnable_mod(sema: &Semantics<RootDatabase>, def: hir::Module) -> | |||
271 | Some(Runnable { nav, kind: RunnableKind::TestMod { path }, cfg }) | 267 | Some(Runnable { nav, kind: RunnableKind::TestMod { path }, cfg }) |
272 | } | 268 | } |
273 | 269 | ||
274 | // FIXME: figure out a proper API here. | ||
275 | pub(crate) fn doc_owner_to_def( | ||
276 | sema: &Semantics<RootDatabase>, | ||
277 | item: SyntaxNode, | ||
278 | ) -> Option<Definition> { | ||
279 | let res: hir::ModuleDef = match_ast! { | ||
280 | match item { | ||
281 | ast::SourceFile(_it) => sema.scope(&item).module()?.into(), | ||
282 | ast::Fn(it) => sema.to_def(&it)?.into(), | ||
283 | ast::Struct(it) => sema.to_def(&it)?.into(), | ||
284 | ast::Enum(it) => sema.to_def(&it)?.into(), | ||
285 | ast::Union(it) => sema.to_def(&it)?.into(), | ||
286 | ast::Trait(it) => sema.to_def(&it)?.into(), | ||
287 | ast::Const(it) => sema.to_def(&it)?.into(), | ||
288 | ast::Static(it) => sema.to_def(&it)?.into(), | ||
289 | ast::TypeAlias(it) => sema.to_def(&it)?.into(), | ||
290 | _ => return None, | ||
291 | } | ||
292 | }; | ||
293 | Some(Definition::ModuleDef(res)) | ||
294 | } | ||
295 | |||
296 | fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Option<Runnable> { | 270 | fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Option<Runnable> { |
297 | let attrs = match def { | 271 | let attrs = match def { |
298 | hir::ModuleDef::Module(it) => it.attrs(sema.db), | 272 | hir::ModuleDef::Module(it) => it.attrs(sema.db), |