From 41745f48d5f867ff0896ce7906b5b4c04e72a767 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 15 Mar 2021 12:18:52 +0100 Subject: move Semantics::visit_file_defs to ide_db::helpers --- crates/ide/src/annotations.rs | 3 ++- crates/ide/src/runnables.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/ide') 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; use hir::{HasSource, Semantics}; use ide_db::{ base_db::{FileId, FilePosition, FileRange}, + helpers::visit_file_defs, RootDatabase, }; use syntax::{ast::NameOwner, AstNode, TextRange, TextSize}; @@ -75,7 +76,7 @@ pub(crate) fn annotations( } } - Semantics::new(db).visit_file_defs(file_id, &mut |def| match def { + visit_file_defs(&Semantics::new(db), file_id, &mut |def| match def { Either::Left(def) => { let node = match def { 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; use ide_db::{ base_db::{FilePosition, FileRange}, defs::Definition, + helpers::visit_file_defs, search::SearchScope, RootDatabase, SymbolKind, }; @@ -105,7 +106,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec { let sema = Semantics::new(db); let mut res = Vec::new(); - sema.visit_file_defs(file_id, &mut |def| match def { + visit_file_defs(&sema, file_id, &mut |def| match def { Either::Left(def) => { let runnable = match def { hir::ModuleDef::Module(it) => runnable_mod(&sema, it), -- cgit v1.2.3