From a2b138e789c79bb3fbd58fb7d0a8f498df8a13bf Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Wed, 10 Dec 2025 14:25:45 -0500 Subject: [PATCH] [ty] Change frequency of invalid `__all__` debug message This was being emitted for every symbol we checked, which is clearly too frequent. This switches to emitting it once per module. --- crates/ty_ide/src/symbols.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/ty_ide/src/symbols.rs b/crates/ty_ide/src/symbols.rs index 89c41cb359..08f659debe 100644 --- a/crates/ty_ide/src/symbols.rs +++ b/crates/ty_ide/src/symbols.rs @@ -470,6 +470,11 @@ impl<'db> SymbolVisitor<'db> { } fn into_flat_symbols(mut self) -> FlatSymbols { + // If `__all__` was found but wasn't recognized, + // then we emit a diagnostic message indicating as such. + if self.all_invalid { + tracing::debug!("Invalid `__all__` in `{}`", self.file.path(self.db)); + } // We want to filter out some of the symbols we collected. // Specifically, to respect conventions around library // interface. @@ -810,14 +815,11 @@ impl<'db> SymbolVisitor<'db> { // if a name should be part of the exported API of a module // or not. When there is `__all__`, we currently follow it // strictly. - if self.all_origin.is_some() { - // If `__all__` is somehow invalid, ignore it and fall - // through as-if `__all__` didn't exist. - if self.all_invalid { - tracing::debug!("Invalid `__all__` in `{}`", self.file.path(self.db)); - } else { - return self.all_names.contains(&*symbol.name); - } + // + // If `__all__` is somehow invalid, ignore it and fall + // through as-if `__all__` didn't exist. + if self.all_origin.is_some() && !self.all_invalid { + return self.all_names.contains(&*symbol.name); } // "Imported symbols are considered private by default. A fixed