RS.CLIPPY.REDUNDANT_ALLOCATION
Redundant allocation
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: redundant_allocation. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for usage of redundant allocations anywhere in the code.
Why is this bad?
Expressions such as Rc<&T>, Rc<Rc<T>>, Rc<Arc<T>>, Rc<Box<T>>, Arc<&T>, Arc<Rc<T>>,
Arc<Arc<T>>, Arc<Box<T>>, Box<&T>, Box<Rc<T>>, Box<Arc<T>>, Box<Box<T>>, add an unnecessary level of indirection.
Example
fn foo(bar: Rc<&usize>) {}
Better:
fn foo(bar: &usize) {}
Configuration
-
avoid-breaking-exported-api: Suppress lints whenever the suggested change would cause breakage for other crates.(default:
true)