diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index 2fc6695fa..e28d077f9 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -108,13 +108,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault { // can't be implemented by default return; } - //TODO: There is no sig.generics anymore and I don't know how to fix this. - //if !sig.generics.ty_params.is_empty() { - // // when the result of `new()` depends on a type parameter we should not require - // // an - // // impl of `Default` - // return; - //} + if !cx.generics.expect("method must have generics").ty_params.is_empty() { + // when the result of `new()` depends on a type parameter we should not require + // an + // impl of `Default` + return; + } if decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) { let self_ty = cx.tcx .type_of(cx.tcx.hir.local_def_id(cx.tcx.hir.get_parent(id))); diff --git a/tests/ui/mut_mut.stderr b/tests/ui/mut_mut.stderr index 31f9178aa..8bfc2fc8a 100644 --- a/tests/ui/mut_mut.stderr +++ b/tests/ui/mut_mut.stderr @@ -39,12 +39,6 @@ error: generally you want to avoid `&mut &mut _` if possible 30 | let y : &mut &mut u32 = &mut &mut 2; | ^^^^^^^^^^^^^ -error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:30:17 - | -30 | let y : &mut &mut u32 = &mut &mut 2; - | ^^^^^^^^^^^^^ - error: generally you want to avoid `&mut &mut _` if possible --> $DIR/mut_mut.rs:35:38 | @@ -63,21 +57,3 @@ error: generally you want to avoid `&mut &mut _` if possible 35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; | ^^^^^^^^^^^^^ -error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:17 - | -35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; - | ^^^^^^^^^^^^^^^^^^ - -error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:22 - | -35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; - | ^^^^^^^^^^^^^ - -error: generally you want to avoid `&mut &mut _` if possible - --> $DIR/mut_mut.rs:35:22 - | -35 | let y : &mut &mut &mut u32 = &mut &mut &mut 2; - | ^^^^^^^^^^^^^ -