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(
42
42
if !ty_ty. has_escaping_bound_vars( ) ;
43
43
if ty_ty. is_sized( cx. tcx. at( ty. span) , cx. param_env) ;
44
44
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;
46
46
then {
47
47
span_lint_and_sugg(
48
48
cx,
Original file line number Diff line number Diff line change @@ -7,8 +7,9 @@ struct C {
7
7
}
8
8
9
9
struct 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 ) > > ) ;
12
13
struct BarBaz ( Vec < Box < S > > ) ;
13
14
struct FooBarBaz ( Vec < Box < C > > ) ;
14
15
Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ LL | struct Foo(Vec<Box<u8>>);
9
9
error: `Vec<T>` is already on the heap, the boxing is unnecessary
10
10
--> $DIR/test.rs:10:12
11
11
|
12
- LL | struct Bar(Vec<Box<u32 >>);
13
- | ^^^^^^^^^^^^^ help: try: `Vec<u32 >`
12
+ LL | struct Bar(Vec<Box<u16 >>);
13
+ | ^^^^^^^^^^^^^ help: try: `Vec<u16 >`
14
14
15
15
error: `Vec<T>` is already on the heap, the boxing is unnecessary
16
- --> $DIR/test.rs:13 :18
16
+ --> $DIR/test.rs:14 :18
17
17
|
18
18
LL | struct FooBarBaz(Vec<Box<C>>);
19
19
| ^^^^^^^^^^^ help: try: `Vec<C>`
You can’t perform that action at this time.
0 commit comments