1 use std::collections::HashMap;
3 struct FooDefault<'a> {
18 impl std::default::Default for FooDefault<'_> {
19 fn default() -> Self {
25 e: Default::default(),
29 i: [vec![], vec![], vec![]],
37 struct TupleDefault(bool, i32, u64);
39 impl std::default::Default for TupleDefault {
40 fn default() -> Self {
49 impl std::default::Default for FooND1 {
50 fn default() -> Self {
59 impl std::default::Default for FooND2 {
60 fn default() -> Self {
75 impl Default for FooNDNew {
76 fn default() -> Self {
81 struct FooNDVec(Vec<i32>);
83 impl Default for FooNDVec {
84 fn default() -> Self {
89 struct StrDefault<'a>(&'a str);
91 impl Default for StrDefault<'_> {
92 fn default() -> Self {
98 struct AlreadyDerived(i32, bool);
107 fn default() -> Self {
118 fn default() -> Self {
123 struct RustIssue26925<T> {
127 // We should watch out for cases where a manual impl is needed because a
128 // derive adds different type bounds (https://github.com/rust-lang/rust/issues/26925).
129 // For example, a struct with Option<T> does not require T: Default, but a derive adds
130 // that type bound anyways. So until #26925 get fixed we should disable lint
131 // for the following case
132 impl<T> Default for RustIssue26925<T> {
133 fn default() -> Self {
138 struct SpecializedImpl<A, B> {
143 impl<T: Default> Default for SpecializedImpl<T, T> {
144 fn default() -> Self {
152 struct WithoutSelfCurly {
156 impl Default for WithoutSelfCurly {
157 fn default() -> Self {
158 WithoutSelfCurly { a: false }
162 struct WithoutSelfParan(bool);
164 impl Default for WithoutSelfParan {
165 fn default() -> Self {
166 WithoutSelfParan(false)