@@ -5,72 +5,95 @@ LL | pub fn box_test1<T>(foo: Box<&T>) {}
5
5
| ^^^^^^^ help: try: `&T`
6
6
|
7
7
= note: `-D clippy::redundant-allocation` implied by `-D warnings`
8
+ = note: `&T` is already a pointer, `Box<&T>` allocate a pointer on heap
8
9
9
10
error: usage of `Box<&T>`
10
11
--> $DIR/redundant_allocation_fixable.rs:28:27
11
12
|
12
13
LL | pub fn box_test2(foo: Box<&MyStruct>) {}
13
14
| ^^^^^^^^^^^^^^ help: try: `&MyStruct`
15
+ |
16
+ = note: `&T` is already a pointer, `Box<&T>` allocate a pointer on heap
14
17
15
18
error: usage of `Box<&T>`
16
19
--> $DIR/redundant_allocation_fixable.rs:30:27
17
20
|
18
21
LL | pub fn box_test3(foo: Box<&MyEnum>) {}
19
22
| ^^^^^^^^^^^^ help: try: `&MyEnum`
23
+ |
24
+ = note: `&T` is already a pointer, `Box<&T>` allocate a pointer on heap
20
25
21
26
error: usage of `Box<Box<T>>`
22
27
--> $DIR/redundant_allocation_fixable.rs:34:30
23
28
|
24
29
LL | pub fn box_test5<T>(foo: Box<Box<T>>) {}
25
30
| ^^^^^^^^^^^ help: try: `Box<T>`
31
+ |
32
+ = note: `Box<T>` is already on the heap, `Box<Box<T>>` makes an extra allocation
26
33
27
34
error: usage of `Rc<&T>`
28
35
--> $DIR/redundant_allocation_fixable.rs:45:29
29
36
|
30
37
LL | pub fn rc_test1<T>(foo: Rc<&T>) {}
31
38
| ^^^^^^ help: try: `&T`
39
+ |
40
+ = note: `&T` is already a pointer, `Rc<&T>` allocate a pointer on heap
32
41
33
42
error: usage of `Rc<&T>`
34
43
--> $DIR/redundant_allocation_fixable.rs:47:26
35
44
|
36
45
LL | pub fn rc_test2(foo: Rc<&MyStruct>) {}
37
46
| ^^^^^^^^^^^^^ help: try: `&MyStruct`
47
+ |
48
+ = note: `&T` is already a pointer, `Rc<&T>` allocate a pointer on heap
38
49
39
50
error: usage of `Rc<&T>`
40
51
--> $DIR/redundant_allocation_fixable.rs:49:26
41
52
|
42
53
LL | pub fn rc_test3(foo: Rc<&MyEnum>) {}
43
54
| ^^^^^^^^^^^ help: try: `&MyEnum`
55
+ |
56
+ = note: `&T` is already a pointer, `Rc<&T>` allocate a pointer on heap
44
57
45
58
error: usage of `Rc<Rc<T>>`
46
59
--> $DIR/redundant_allocation_fixable.rs:53:24
47
60
|
48
61
LL | pub fn rc_test6(a: Rc<Rc<bool>>) {}
49
62
| ^^^^^^^^^^^^ help: try: `Rc<bool>`
63
+ |
64
+ = note: `Rc<T>` is already on the heap, `Rc<Rc<T>>` makes an extra allocation
50
65
51
66
error: usage of `Arc<&T>`
52
67
--> $DIR/redundant_allocation_fixable.rs:64:30
53
68
|
54
69
LL | pub fn arc_test1<T>(foo: Arc<&T>) {}
55
70
| ^^^^^^^ help: try: `&T`
71
+ |
72
+ = note: `&T` is already a pointer, `Arc<&T>` allocate a pointer on heap
56
73
57
74
error: usage of `Arc<&T>`
58
75
--> $DIR/redundant_allocation_fixable.rs:66:27
59
76
|
60
77
LL | pub fn arc_test2(foo: Arc<&MyStruct>) {}
61
78
| ^^^^^^^^^^^^^^ help: try: `&MyStruct`
79
+ |
80
+ = note: `&T` is already a pointer, `Arc<&T>` allocate a pointer on heap
62
81
63
82
error: usage of `Arc<&T>`
64
83
--> $DIR/redundant_allocation_fixable.rs:68:27
65
84
|
66
85
LL | pub fn arc_test3(foo: Arc<&MyEnum>) {}
67
86
| ^^^^^^^^^^^^ help: try: `&MyEnum`
87
+ |
88
+ = note: `&T` is already a pointer, `Arc<&T>` allocate a pointer on heap
68
89
69
90
error: usage of `Arc<Arc<T>>`
70
91
--> $DIR/redundant_allocation_fixable.rs:72:25
71
92
|
72
93
LL | pub fn arc_test7(a: Arc<Arc<bool>>) {}
73
94
| ^^^^^^^^^^^^^^ help: try: `Arc<bool>`
95
+ |
96
+ = note: `Arc<T>` is already on the heap, `Arc<Arc<T>>` makes an extra allocation
74
97
75
98
error: aborting due to 12 previous errors
76
99
0 commit comments