File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
tests/ui-toml/vec_box_sized Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ pub(super) fn check(
4242 if !ty_ty. has_escaping_bound_vars( ) ;
4343 if ty_ty. is_sized( cx. tcx. at( ty. span) , cx. param_env) ;
4444 if let Ok ( ty_ty_size) = cx. layout_of( ty_ty) . map( |l| l. size. bytes( ) ) ;
45- if ty_ty_size <= box_size_threshold;
45+ if ty_ty_size < box_size_threshold;
4646 then {
4747 span_lint_and_sugg(
4848 cx,
Original file line number Diff line number Diff line change @@ -7,8 +7,9 @@ struct C {
77}
88
99struct Foo ( Vec < Box < u8 > > ) ;
10- struct Bar ( Vec < Box < u32 > > ) ;
11- struct Baz ( Vec < Box < ( u32 , u32 ) > > ) ;
10+ struct Bar ( Vec < Box < u16 > > ) ;
11+ struct Quux ( Vec < Box < u32 > > ) ;
12+ struct Baz ( Vec < Box < ( u16 , u16 ) > > ) ;
1213struct BarBaz ( Vec < Box < S > > ) ;
1314struct FooBarBaz ( Vec < Box < C > > ) ;
1415
Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ LL | struct Foo(Vec<Box<u8>>);
99error: `Vec<T>` is already on the heap, the boxing is unnecessary
1010 --> $DIR/test.rs:10:12
1111 |
12- LL | struct Bar(Vec<Box<u32 >>);
13- | ^^^^^^^^^^^^^ help: try: `Vec<u32 >`
12+ LL | struct Bar(Vec<Box<u16 >>);
13+ | ^^^^^^^^^^^^^ help: try: `Vec<u16 >`
1414
1515error: `Vec<T>` is already on the heap, the boxing is unnecessary
16- --> $DIR/test.rs:13 :18
16+ --> $DIR/test.rs:14 :18
1717 |
1818LL | struct FooBarBaz(Vec<Box<C>>);
1919 | ^^^^^^^^^^^ help: try: `Vec<C>`
You can’t perform that action at this time.
0 commit comments