diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/derivable_impls.fixed')
-rw-r--r-- | src/tools/clippy/tests/ui/derivable_impls.fixed | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/derivable_impls.fixed b/src/tools/clippy/tests/ui/derivable_impls.fixed index ee8456f5d..89ec33a0d 100644 --- a/src/tools/clippy/tests/ui/derivable_impls.fixed +++ b/src/tools/clippy/tests/ui/derivable_impls.fixed @@ -231,4 +231,41 @@ impl Default for NonExhaustiveEnum { } } +// https://github.com/rust-lang/rust-clippy/issues/10396 + +#[derive(Default)] +struct DefaultType; + +struct GenericType<T = DefaultType> { + t: T, +} + +impl Default for GenericType { + fn default() -> Self { + Self { t: Default::default() } + } +} + +struct InnerGenericType<T> { + t: T, +} + +impl Default for InnerGenericType<DefaultType> { + fn default() -> Self { + Self { t: Default::default() } + } +} + +struct OtherGenericType<T = DefaultType> { + inner: InnerGenericType<T>, +} + +impl Default for OtherGenericType { + fn default() -> Self { + Self { + inner: Default::default(), + } + } +} + fn main() {} |