Skip to main content

MutationEvidence

Trait MutationEvidence 

Source
pub trait MutationEvidence {
    // Required method
    fn reachability_caveats(&self) -> &[ReachabilityCaveat];

    // Provided method
    fn may_auto_apply_mutation(&self) -> bool { ... }
}
Expand description

The one question every mutation surface asks before it offers, plans, or performs a dead-code finding’s removal.

A finding whose reachability verdict rests on a file the run never fully read is still REPORTED, always: a caveat withholds no finding, changes no severity, and moves no exit code. What it withholds is the automation. The predicate lives here, next to the findings, rather than in any one consumer, because it was re-derived per surface three times and a fourth door opened every time: fallow fix, the LSP quick fix, and the auto_fixable flag an agent plans against each answered it differently. Every one of those now calls Self::may_auto_apply_mutation, so a sixth finding type or a fourth mutation surface cannot silently opt out.

Implemented only by the findings that can carry a caveat. A finding type that exposes an auto-fixable mutation and does NOT implement this trait is the bug this trait exists to make visible; every_auto_fixable_dead_code_ mutation_is_gated in this module’s tests pins that.

Required Methods§

Source

fn reachability_caveats(&self) -> &[ReachabilityCaveat]

The advisory caveats recorded on the reachability verdict behind this finding. Empty when the run analyzed every file it discovered.

Provided Methods§

Source

fn may_auto_apply_mutation(&self) -> bool

Whether this finding’s mutation may be applied without a human first being told the evidence is incomplete. THE gate: never re-derive it, never widen it per surface.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§