pub static BARE_TRAIT_OBJECTS: &Lint
Expand description

The bare_trait_objects lint suggests using dyn Trait for trait objects.

§Example

trait Trait { }

fn takes_trait_object(_: Box<Trait>) {
}

{{produces}}

§Explanation

Without the dyn indicator, it can be ambiguous or confusing when reading code as to whether or not you are looking at a trait object. The dyn keyword makes it explicit, and adds a symmetry to contrast with impl Trait.