File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
#![warn(clippy::default_box_assignments)]
2
2
3
3
fn with_default<T: Default>(b: &mut Box<T>) {
4
- *(*b) = T::default();
4
+ **b = T::default();
5
5
//~^ default_box_assignments
6
6
}
7
7
8
8
fn with_sized<T>(b: &mut Box<T>, t: T) {
9
- *(*b) = t;
9
+ **b = t;
10
10
//~^ default_box_assignments
11
11
}
12
12
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ error: creating a new box
2
2
--> tests/ui/default_box_assignments.rs:4:5
3
3
|
4
4
LL | *b = Box::new(T::default());
5
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*(*b) = T::default()`
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `**b = T::default()`
6
6
|
7
7
= note: this creates a needless allocation
8
8
= note: `-D clippy::default-box-assignments` implied by `-D warnings`
@@ -12,7 +12,7 @@ error: creating a new box
12
12
--> tests/ui/default_box_assignments.rs:9:5
13
13
|
14
14
LL | *b = Box::new(t);
15
- | ^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*(*b) = t`
15
+ | ^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `**b = t`
16
16
|
17
17
= note: this creates a needless allocation
18
18
You can’t perform that action at this time.
0 commit comments