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 11#![warn(clippy::default_box_assignments)]
22
33fn with_default<T: Default>(b: &mut Box<T>) {
4- *(*b) = T::default();
4+ **b = T::default();
55 //~^ default_box_assignments
66}
77
88fn with_sized<T>(b: &mut Box<T>, t: T) {
9- *(*b) = t;
9+ **b = t;
1010 //~^ default_box_assignments
1111}
1212
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ error: creating a new box
22 --> tests/ui/default_box_assignments.rs:4:5
33 |
44LL | *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()`
66 |
77 = note: this creates a needless allocation
88 = note: `-D clippy::default-box-assignments` implied by `-D warnings`
@@ -12,7 +12,7 @@ error: creating a new box
1212 --> tests/ui/default_box_assignments.rs:9:5
1313 |
1414LL | *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`
1616 |
1717 = note: this creates a needless allocation
1818
You can’t perform that action at this time.
0 commit comments