pub(crate) static UNUSED_ALLOCATION: &Lint
Expand description

The unused_allocation lint detects unnecessary allocations that can be eliminated.


fn main() {
    let a = Box::new([1, 2, 3]).len();



When a box expression is immediately coerced to a reference, then the allocation is unnecessary, and a reference (using & or &mut) should be used instead to avoid the allocation.