File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( box_syntax) ]
2+ #![ deny( unused_allocation) ]
3+
4+ fn main ( ) {
5+ _ = ( box [ 1 ] ) . len ( ) ; //~ error: unnecessary allocation, use `&` instead
6+ _ = Box :: new ( [ 1 ] ) . len ( ) ; //~ error: unnecessary allocation, use `&` instead
7+ }
Original file line number Diff line number Diff line change 1+ error: unnecessary allocation, use `&` instead
2+ --> $DIR/unused-allocation.rs:5:9
3+ |
4+ LL | _ = (box [1]).len();
5+ | ^^^^^^^^^
6+ |
7+ note: the lint level is defined here
8+ --> $DIR/unused-allocation.rs:2:9
9+ |
10+ LL | #![deny(unused_allocation)]
11+ | ^^^^^^^^^^^^^^^^^
12+
13+ error: unnecessary allocation, use `&` instead
14+ --> $DIR/unused-allocation.rs:6:9
15+ |
16+ LL | _ = Box::new([1]).len();
17+ | ^^^^^^^^^^^^^
18+
19+ error: aborting due to 2 previous errors
20+
You can’t perform that action at this time.
0 commit comments