aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-03-15 11:18:52 +0000
committerLukas Wirth <[email protected]>2021-03-15 11:18:52 +0000
commit41745f48d5f867ff0896ce7906b5b4c04e72a767 (patch)
tree8a70342d903be16b20c62f8800a59af368ffb012 /crates/ide
parenta1c96e04be55b3412e5510fc8d09cd82675dd4cd (diff)
move Semantics::visit_file_defs to ide_db::helpers
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/annotations.rs3
-rw-r--r--crates/ide/src/runnables.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/crates/ide/src/annotations.rs b/crates/ide/src/annotations.rs
index c3422ce70..72492f826 100644
--- a/crates/ide/src/annotations.rs
+++ b/crates/ide/src/annotations.rs
@@ -2,6 +2,7 @@ use either::Either;
2use hir::{HasSource, Semantics}; 2use hir::{HasSource, Semantics};
3use ide_db::{ 3use ide_db::{
4 base_db::{FileId, FilePosition, FileRange}, 4 base_db::{FileId, FilePosition, FileRange},
5 helpers::visit_file_defs,
5 RootDatabase, 6 RootDatabase,
6}; 7};
7use syntax::{ast::NameOwner, AstNode, TextRange, TextSize}; 8use syntax::{ast::NameOwner, AstNode, TextRange, TextSize};
@@ -75,7 +76,7 @@ pub(crate) fn annotations(
75 } 76 }
76 } 77 }
77 78
78 Semantics::new(db).visit_file_defs(file_id, &mut |def| match def { 79 visit_file_defs(&Semantics::new(db), file_id, &mut |def| match def {
79 Either::Left(def) => { 80 Either::Left(def) => {
80 let node = match def { 81 let node = match def {
81 hir::ModuleDef::Const(konst) => { 82 hir::ModuleDef::Const(konst) => {
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs
index 17454f270..0c7a8fbf8 100644
--- a/crates/ide/src/runnables.rs
+++ b/crates/ide/src/runnables.rs
@@ -8,6 +8,7 @@ use ide_assists::utils::test_related_attribute;
8use ide_db::{ 8use ide_db::{
9 base_db::{FilePosition, FileRange}, 9 base_db::{FilePosition, FileRange},
10 defs::Definition, 10 defs::Definition,
11 helpers::visit_file_defs,
11 search::SearchScope, 12 search::SearchScope,
12 RootDatabase, SymbolKind, 13 RootDatabase, SymbolKind,
13}; 14};
@@ -105,7 +106,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
105 let sema = Semantics::new(db); 106 let sema = Semantics::new(db);
106 107
107 let mut res = Vec::new(); 108 let mut res = Vec::new();
108 sema.visit_file_defs(file_id, &mut |def| match def { 109 visit_file_defs(&sema, file_id, &mut |def| match def {
109 Either::Left(def) => { 110 Either::Left(def) => {
110 let runnable = match def { 111 let runnable = match def {
111 hir::ModuleDef::Module(it) => runnable_mod(&sema, it), 112 hir::ModuleDef::Module(it) => runnable_mod(&sema, it),