File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 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 {
8888 // shouldn't be implemented when it is hidden in docs
8989 return ;
9090 }
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`
10094 return ;
10195 }
10296 if_chain ! {
Original file line number Diff line number Diff line change @@ -212,3 +212,17 @@ impl DocHidden {
212212}
213213
214214fn 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