blob: 4b7bd4a0eeaebdae607e36b5f93d2b1b3324b749 [file] [log] [blame] [edit]
error: creating a new box
--> tests/ui/replace_box.rs:4:5
|
LL | *b = Box::new(T::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `**b = T::default()`
|
= note: this creates a needless allocation
= note: `-D clippy::replace-box` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::replace_box)]`
error: creating a new box
--> tests/ui/replace_box.rs:9:5
|
LL | *b = Box::new(t);
| ^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `**b = t`
|
= note: this creates a needless allocation
error: creating a new box with default content
--> tests/ui/replace_box.rs:44:5
|
LL | b = Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with default instead: `*b = Default::default()`
|
= note: this creates a needless allocation
error: creating a new box with default content
--> tests/ui/replace_box.rs:46:5
|
LL | b = Box::default();
| ^^^^^^^^^^^^^^^^^^ help: replace existing content with default instead: `*b = Default::default()`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:58:5
|
LL | b = Box::new(5);
| ^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*b = 5`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:61:5
|
LL | b = Box::new(mac!(three));
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*b = mac!(three)`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:86:9
|
LL | x = Box::new(Foo { inner: String::new() });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*x = Foo { inner: String::new() }`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:92:9
|
LL | x = Box::new(Foo { inner: String::new() });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*x = Foo { inner: String::new() }`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:97:38
|
LL | static R: fn(&mut Box<String>) = |x| *x = Box::new(String::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `**x = String::new()`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:122:5
|
LL | s.b = Box::new(T::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*s.b = T::new()`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:126:5
|
LL | s.b = Box::new(T::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*s.b = T::new()`
|
= note: this creates a needless allocation
error: creating a new box
--> tests/ui/replace_box.rs:136:5
|
LL | q.0 = Box::new(T::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace existing content with inner value instead: `*q.0 = T::new()`
|
= note: this creates a needless allocation
error: aborting due to 12 previous errors