]> git.lizzy.rs Git - rust.git/blob - src/docs/boxed_local.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / boxed_local.txt
1 ### What it does
2 Checks for usage of `Box<T>` where an unboxed `T` would
3 work fine.
4
5 ### Why is this bad?
6 This is an unnecessary allocation, and bad for
7 performance. It is only necessary to allocate if you wish to move the box
8 into something.
9
10 ### Example
11 ```
12 fn foo(x: Box<u32>) {}
13 ```
14
15 Use instead:
16 ```
17 fn foo(x: u32) {}
18 ```