From 5ba37f3f8ee08a9dd7e725c4ed457487f5dee33f Mon Sep 17 00:00:00 2001 From: David Barsky Date: Tue, 16 Apr 2024 20:07:56 -0400 Subject: [PATCH] chore: fix a few spans without `.entered()` --- crates/hir-ty/src/diagnostics/unsafe_check.rs | 2 +- crates/hir-ty/src/inhabitedness.rs | 4 ++-- crates/hir/src/lib.rs | 13 +++++++------ crates/hir/src/semantics.rs | 4 ++-- crates/hir/src/semantics/source_to_def.rs | 6 +++--- .../src/handlers/add_missing_impl_members.rs | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/crates/hir-ty/src/diagnostics/unsafe_check.rs b/crates/hir-ty/src/diagnostics/unsafe_check.rs index f13ad30c2a2e..081b4d83a86f 100644 --- a/crates/hir-ty/src/diagnostics/unsafe_check.rs +++ b/crates/hir-ty/src/diagnostics/unsafe_check.rs @@ -13,7 +13,7 @@ use crate::{ }; pub fn missing_unsafe(db: &dyn HirDatabase, def: DefWithBodyId) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "missing_unsafe",); + let _p = tracing::span!(tracing::Level::INFO, "missing_unsafe").entered(); let mut res = Vec::new(); let is_unsafe = match def { diff --git a/crates/hir-ty/src/inhabitedness.rs b/crates/hir-ty/src/inhabitedness.rs index f0a28d322c46..7546369d8d47 100644 --- a/crates/hir-ty/src/inhabitedness.rs +++ b/crates/hir-ty/src/inhabitedness.rs @@ -15,7 +15,7 @@ use crate::{ // FIXME: Turn this into a query, it can be quite slow /// Checks whether a type is visibly uninhabited from a particular module. pub(crate) fn is_ty_uninhabited_from(db: &dyn HirDatabase, ty: &Ty, target_mod: ModuleId) -> bool { - let _p = tracing::span!(tracing::Level::INFO, "is_ty_uninhabited_from", ?ty); + let _p = tracing::span!(tracing::Level::INFO, "is_ty_uninhabited_from", ?ty).entered(); let mut uninhabited_from = UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() }; let inhabitedness = ty.visit_with(&mut uninhabited_from, DebruijnIndex::INNERMOST); @@ -30,7 +30,7 @@ pub(crate) fn is_enum_variant_uninhabited_from( subst: &Substitution, target_mod: ModuleId, ) -> bool { - let _p = tracing::span!(tracing::Level::INFO, "is_enum_variant_uninhabited_from",); + let _p = tracing::span!(tracing::Level::INFO, "is_enum_variant_uninhabited_from").entered(); let mut uninhabited_from = UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() }; diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 12f5a89caaa7..bcd94a611a90 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -239,7 +239,7 @@ impl Crate { db: &dyn DefDatabase, query: import_map::Query, ) -> impl Iterator> { - let _p = tracing::span!(tracing::Level::INFO, "query_external_importables"); + let _p = tracing::span!(tracing::Level::INFO, "query_external_importables").entered(); import_map::search_dependencies(db, self.into(), &query).into_iter().map(|item| { match ItemInNs::from(item) { ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id), @@ -548,7 +548,8 @@ impl Module { acc: &mut Vec, style_lints: bool, ) { - let _p = tracing::span!(tracing::Level::INFO, "Module::diagnostics", name = ?self.name(db)); + let _p = tracing::span!(tracing::Level::INFO, "Module::diagnostics", name = ?self.name(db)) + .entered(); let def_map = self.id.def_map(db.upcast()); for diag in def_map.diagnostics() { if diag.in_module != self.id.local_id { @@ -4494,7 +4495,7 @@ impl Type { name: Option<&Name>, mut callback: impl FnMut(Function) -> Option, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "iterate_method_candidates"); + let _p = tracing::span!(tracing::Level::INFO, "iterate_method_candidates").entered(); let mut slot = None; self.iterate_method_candidates_dyn( @@ -4582,7 +4583,7 @@ impl Type { name: Option<&Name>, mut callback: impl FnMut(AssocItem) -> Option, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "iterate_path_candidates"); + let _p = tracing::span!(tracing::Level::INFO, "iterate_path_candidates").entered(); let mut slot = None; self.iterate_path_candidates_dyn( db, @@ -4649,7 +4650,7 @@ impl Type { &'a self, db: &'a dyn HirDatabase, ) -> impl Iterator + 'a { - let _p = tracing::span!(tracing::Level::INFO, "applicable_inherent_traits"); + let _p = tracing::span!(tracing::Level::INFO, "applicable_inherent_traits").entered(); self.autoderef_(db) .filter_map(|ty| ty.dyn_trait()) .flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id)) @@ -4657,7 +4658,7 @@ impl Type { } pub fn env_traits<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator + 'a { - let _p = tracing::span!(tracing::Level::INFO, "env_traits"); + let _p = tracing::span!(tracing::Level::INFO, "env_traits").entered(); self.autoderef_(db) .filter(|ty| matches!(ty.kind(Interner), TyKind::Placeholder(_))) .flat_map(|ty| { diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 9796009cb45c..e1516fcdcbee 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -722,7 +722,7 @@ impl<'db> SemanticsImpl<'db> { mut token: SyntaxToken, f: &mut dyn FnMut(InFile) -> ControlFlow<()>, ) { - let _p = tracing::span!(tracing::Level::INFO, "descend_into_macros"); + let _p = tracing::span!(tracing::Level::INFO, "descend_into_macros").entered(); let (sa, span, file_id) = match token.parent().and_then(|parent| self.analyze_no_infer(&parent)) { Some(sa) => match sa.file_id.file_id() { @@ -1359,7 +1359,7 @@ impl<'db> SemanticsImpl<'db> { offset: Option, infer_body: bool, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "Semantics::analyze_impl"); + let _p = tracing::span!(tracing::Level::INFO, "Semantics::analyze_impl").entered(); let node = self.find_file(node); let container = self.with_ctx(|ctx| ctx.find_container(node))?; diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index d4d6f0b243fd..434e4b5a0cf1 100644 --- a/crates/hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs @@ -118,7 +118,7 @@ pub(super) struct SourceToDefCtx<'a, 'b> { impl SourceToDefCtx<'_, '_> { pub(super) fn file_to_def(&self, file: FileId) -> SmallVec<[ModuleId; 1]> { - let _p = tracing::span!(tracing::Level::INFO, "SourceBinder::file_to_module_def"); + let _p = tracing::span!(tracing::Level::INFO, "SourceBinder::file_to_module_def").entered(); let mut mods = SmallVec::new(); for &crate_id in self.db.relevant_crates(file).iter() { // FIXME: inner items @@ -133,7 +133,7 @@ impl SourceToDefCtx<'_, '_> { } pub(super) fn module_to_def(&mut self, src: InFile) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "module_to_def"); + let _p = tracing::span!(tracing::Level::INFO, "module_to_def").entered(); let parent_declaration = src .syntax() .ancestors_with_macros_skip_attr_item(self.db.upcast()) @@ -158,7 +158,7 @@ impl SourceToDefCtx<'_, '_> { } pub(super) fn source_file_to_def(&self, src: InFile) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "source_file_to_def"); + let _p = tracing::span!(tracing::Level::INFO, "source_file_to_def").entered(); let file_id = src.file_id.original_file(self.db.upcast()); self.file_to_def(file_id).first().copied() } diff --git a/crates/ide-assists/src/handlers/add_missing_impl_members.rs b/crates/ide-assists/src/handlers/add_missing_impl_members.rs index c1b95bb1e253..24a32086f3da 100644 --- a/crates/ide-assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ide-assists/src/handlers/add_missing_impl_members.rs @@ -105,7 +105,7 @@ fn add_missing_impl_members_inner( assist_id: &'static str, label: &'static str, ) -> Option<()> { - let _p = tracing::span!(tracing::Level::INFO, "add_missing_impl_members_inner"); + let _p = tracing::span!(tracing::Level::INFO, "add_missing_impl_members_inner").entered(); let impl_def = ctx.find_node_at_offset::()?; let impl_ = ctx.sema.to_def(&impl_def)?;