pub struct DeadCodeAnalyzer {
pub entry_points: Vec<String>,
}Expand description
Detect non-exported functions/classes that may be dead code.
Three signals stack:
is_in_file_referenced— same-file usage via AST identifier scan (precise; substring matches in strings / comments don’t count).ctx.project.is_called_externally— cross-file call graph from parser.collect_token_concat_targets— for C/C++ files, scan#define ... ##macros and per-call-site invocations to recover potential function names that the macro would expand to (e.g._handle##X##Attrpaired withSTYLE_DEF(color, Color, ...)produces a plausible_handleColorAttr). These names are added to the in-file reference set so X-macro dispatch tables don’t drown the file in false positives. Imperfect but vastly better than the previous “any#define ##skips the whole file” nuke.
When ctx.tree is unavailable, falls back to the legacy substring scan.
Fields§
§entry_points: Vec<String>Names treated as entry points / framework callbacks. Functions with these names are never reported as dead, even when nothing else references them.
Trait Implementations§
Source§impl Default for DeadCodeAnalyzer
impl Default for DeadCodeAnalyzer
Source§impl Plugin for DeadCodeAnalyzer
impl Plugin for DeadCodeAnalyzer
Source§fn smells(&self) -> Vec<String>
fn smells(&self) -> Vec<String>
Smell names this plugin can produce.
Used by the host for smell-level filtering, docs, and
cha plugin list.
Default is empty — plugins should override to declare their smells.Source§fn description(&self) -> &str
fn description(&self) -> &str
Short description of what the plugin detects.
Source§fn analyze(&self, ctx: &AnalysisContext<'_>) -> Vec<Finding>
fn analyze(&self, ctx: &AnalysisContext<'_>) -> Vec<Finding>
Run analysis on a single file and return findings.
List of authors.
Auto Trait Implementations§
impl Freeze for DeadCodeAnalyzer
impl RefUnwindSafe for DeadCodeAnalyzer
impl Send for DeadCodeAnalyzer
impl Sync for DeadCodeAnalyzer
impl Unpin for DeadCodeAnalyzer
impl UnsafeUnpin for DeadCodeAnalyzer
impl UnwindSafe for DeadCodeAnalyzer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more