mirror of
https://github.com/rust-lang/rust.git
synced 2026-02-15 01:14:05 +00:00
192 lines
4.1 KiB
Plaintext
192 lines
4.1 KiB
Plaintext
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:20:1
|
|
|
|
|
LL | / impl std::default::Default for FooDefault<'_> {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | Self {
|
|
... |
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
= note: `-D clippy::derivable-impls` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::derivable_impls)]`
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ struct FooDefault<'a> {
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:42:1
|
|
|
|
|
LL | / impl std::default::Default for TupleDefault {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | Self(false, 0, 0u64)
|
|
LL | | }
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ struct TupleDefault(bool, i32, u64);
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:95:1
|
|
|
|
|
LL | / impl Default for StrDefault<'_> {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | Self("")
|
|
LL | | }
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ struct StrDefault<'a>(&'a str);
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:122:1
|
|
|
|
|
LL | / impl Default for Y {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | Self(mac!())
|
|
LL | | }
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ struct Y(u32);
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:162:1
|
|
|
|
|
LL | / impl Default for WithoutSelfCurly {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | WithoutSelfCurly { a: false }
|
|
LL | | }
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ struct WithoutSelfCurly {
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:171:1
|
|
|
|
|
LL | / impl Default for WithoutSelfParan {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | WithoutSelfParan(false)
|
|
LL | | }
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ struct WithoutSelfParan(bool);
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:194:1
|
|
|
|
|
LL | / impl Default for DirectDefaultDefaultCall {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
... |
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ pub struct DirectDefaultDefaultCall {
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:206:1
|
|
|
|
|
LL | / impl Default for EquivalentToDefaultDefaultCallVec {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
... |
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ pub struct EquivalentToDefaultDefaultCallVec {
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:234:1
|
|
|
|
|
LL | / impl Default for EquivalentToDefaultDefaultCallLocal {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
... |
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ pub struct EquivalentToDefaultDefaultCallLocal {
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:274:1
|
|
|
|
|
LL | / impl Default for RepeatDefault1 {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | RepeatDefault1 { a: [0; 32] }
|
|
LL | | }
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ pub struct RepeatDefault1 {
|
|
|
|
|
|
|
error: this `impl` can be derived
|
|
--> tests/ui/derivable_impls.rs:309:1
|
|
|
|
|
LL | / impl Default for SimpleEnum {
|
|
LL | |
|
|
LL | | fn default() -> Self {
|
|
LL | | SimpleEnum::Bar
|
|
LL | | }
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: replace the manual implementation with a derive attribute and mark the default variant
|
|
|
|
|
LL + #[derive(Default)]
|
|
LL ~ pub enum SimpleEnum {
|
|
LL | Foo,
|
|
LL ~ #[default]
|
|
LL ~ Bar,
|
|
|
|
|
|
|
error: aborting due to 11 previous errors
|
|
|