5 use std::collections::HashMap;
8 struct FooDefault<'a> {
26 struct TupleDefault(bool, i32, u64);
34 impl std::default::Default for FooND1 {
35 fn default() -> Self {
44 impl std::default::Default for FooND2 {
45 fn default() -> Self {
60 impl Default for FooNDNew {
61 fn default() -> Self {
66 struct FooNDVec(Vec<i32>);
68 impl Default for FooNDVec {
69 fn default() -> Self {
75 struct StrDefault<'a>(&'a str);
80 struct AlreadyDerived(i32, bool);
89 fn default() -> Self {
102 struct RustIssue26925<T> {
106 // We should watch out for cases where a manual impl is needed because a
107 // derive adds different type bounds (https://github.com/rust-lang/rust/issues/26925).
108 // For example, a struct with Option<T> does not require T: Default, but a derive adds
109 // that type bound anyways. So until #26925 get fixed we should disable lint
110 // for the following case
111 impl<T> Default for RustIssue26925<T> {
112 fn default() -> Self {
117 struct SpecializedImpl<A, B> {
122 impl<T: Default> Default for SpecializedImpl<T, T> {
123 fn default() -> Self {
132 struct WithoutSelfCurly {
139 struct WithoutSelfParan(bool);
143 // https://github.com/rust-lang/rust-clippy/issues/7655
145 pub struct SpecializedImpl2<T> {
149 impl Default for SpecializedImpl2<String> {
150 fn default() -> Self {
151 Self { v: Vec::new() }
155 // https://github.com/rust-lang/rust-clippy/issues/7654
164 impl Default for Color {
165 fn default() -> Self {
166 Color { r: 0, g: 0, b: 0 }
176 impl Default for Color2 {
178 fn default() -> Self {
179 Self { r: 0, g: 0, b: 0 }
184 pub struct RepeatDefault1 {
190 pub struct RepeatDefault2 {
194 impl Default for RepeatDefault2 {
195 fn default() -> Self {
196 RepeatDefault2 { a: [0; 33] }
200 // https://github.com/rust-lang/rust-clippy/issues/7753
202 pub enum IntOrString {
207 impl Default for IntOrString {
208 fn default() -> Self {