summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/derivable_impls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/derivable_impls.rs')
-rw-r--r--src/tools/clippy/tests/ui/derivable_impls.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/derivable_impls.rs b/src/tools/clippy/tests/ui/derivable_impls.rs
index 14af419bc..def6e4116 100644
--- a/src/tools/clippy/tests/ui/derivable_impls.rs
+++ b/src/tools/clippy/tests/ui/derivable_impls.rs
@@ -267,4 +267,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() {}