mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 08:30:45 +00:00
47 lines
1.5 KiB
Text
47 lines
1.5 KiB
Text
error: unnecessary struct building
|
|
--> $DIR/unnecessary_struct_initialization.rs:32:9
|
|
|
|
|
LL | Self { ..*self }
|
|
| ^^^^^^^^^^^^^^^^ help: replace with: `*self`
|
|
|
|
|
= note: `-D clippy::unnecessary-struct-initialization` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_struct_initialization)]`
|
|
|
|
error: unnecessary struct building
|
|
--> $DIR/unnecessary_struct_initialization.rs:39:17
|
|
|
|
|
LL | let mut b = S { ..a };
|
|
| ^^^^^^^^^ help: replace with: `a`
|
|
|
|
error: unnecessary struct building
|
|
--> $DIR/unnecessary_struct_initialization.rs:42:18
|
|
|
|
|
LL | let c = &mut S { ..b };
|
|
| ^^^^^^^^^ help: replace with: `b`
|
|
|
|
error: unnecessary struct building
|
|
--> $DIR/unnecessary_struct_initialization.rs:50:14
|
|
|
|
|
LL | let g = &S { ..f };
|
|
| ^^^^^^^^^ help: replace with: `f`
|
|
|
|
error: unnecessary struct building
|
|
--> $DIR/unnecessary_struct_initialization.rs:53:18
|
|
|
|
|
LL | let h = &mut S {
|
|
| __________________^
|
|
LL | | ..*Box::new(S { f: String::from("foo") })
|
|
LL | | };
|
|
| |_____^ help: replace with: `*Box::new(S { f: String::from("foo") })`
|
|
|
|
error: unnecessary struct building
|
|
--> $DIR/unnecessary_struct_initialization.rs:72:18
|
|
|
|
|
LL | let p = &mut T {
|
|
| __________________^
|
|
LL | | ..*Box::new(T { f: 5 })
|
|
LL | | };
|
|
| |_____^ help: replace with: `*Box::new(T { f: 5 })`
|
|
|
|
error: aborting due to 6 previous errors
|
|
|