rust/tests/ui/default_constructed_unit_struct.stderr
Icxolu 9428138562 adds lint to detect construction of unit struct using default
Using `default` to construct a unit struct increases code complexity and
adds a function call. This can be avoided by simply removing the call to
`default` and simply construct by name.
2023-04-26 21:12:59 +02:00

28 lines
1.1 KiB
Text

error: Use of `default` to create a unit struct.
--> $DIR/default_constructed_unit_struct.rs:39:33
|
LL | inner: PhantomData::default(),
| ^^^^^^^ help: remove this call to `default`
|
= note: `-D clippy::default-constructed-unit-struct` implied by `-D warnings`
error: Use of `default` to create a unit struct.
--> $DIR/default_constructed_unit_struct.rs:62:35
|
LL | let _ = PhantomData::<usize>::default();
| ^^^^^^^ help: remove this call to `default`
error: Use of `default` to create a unit struct.
--> $DIR/default_constructed_unit_struct.rs:63:44
|
LL | let _: PhantomData<i32> = PhantomData::default();
| ^^^^^^^ help: remove this call to `default`
error: Use of `default` to create a unit struct.
--> $DIR/default_constructed_unit_struct.rs:64:25
|
LL | let _ = UnitStruct::default();
| ^^^^^^^ help: remove this call to `default`
error: aborting due to 4 previous errors