File tree 2 files changed +17
-9
lines changed
2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -88,15 +88,9 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
88
88
// shouldn't be implemented when it is hidden in docs
89
89
return ;
90
90
}
91
- if impl_item
92
- . generics
93
- . params
94
- . iter ( )
95
- . any ( |gen| matches ! ( gen . kind, hir:: GenericParamKind :: Type { .. } ) )
96
- {
97
- // when the result of `new()` depends on a type parameter we should not require
98
- // an
99
- // impl of `Default`
91
+ if !impl_item. generics . params . is_empty ( ) {
92
+ // when the result of `new()` depends on a parameter we should not require
93
+ // an impl of `Default`
100
94
return ;
101
95
}
102
96
if_chain ! {
Original file line number Diff line number Diff line change @@ -212,3 +212,17 @@ impl DocHidden {
212
212
}
213
213
214
214
fn main ( ) { }
215
+
216
+ pub struct IgnoreConstGenericNew ( usize ) ;
217
+ impl IgnoreConstGenericNew {
218
+ pub fn new < const N : usize > ( ) -> Self {
219
+ Self ( N )
220
+ }
221
+ }
222
+
223
+ pub struct IgnoreLifetimeNew ;
224
+ impl IgnoreLifetimeNew {
225
+ pub fn new < ' a > ( ) -> Self {
226
+ Self
227
+ }
228
+ }
You can’t perform that action at this time.
0 commit comments