diff options
Diffstat (limited to 'src/tools/clippy/src/docs/redundant_allocation.txt')
-rw-r--r-- | src/tools/clippy/src/docs/redundant_allocation.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/redundant_allocation.txt b/src/tools/clippy/src/docs/redundant_allocation.txt new file mode 100644 index 000000000..86bf51e8d --- /dev/null +++ b/src/tools/clippy/src/docs/redundant_allocation.txt @@ -0,0 +1,17 @@ +### What it does +Checks for use 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) {} +```
\ No newline at end of file |