mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 08:30:45 +00:00
Update tests; make it work with generics on context
This commit is contained in:
parent
b0616df931
commit
09143cdaf0
2 changed files with 6 additions and 31 deletions
|
@ -108,13 +108,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
||||||
// can't be implemented by default
|
// can't be implemented by default
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//TODO: There is no sig.generics anymore and I don't know how to fix this.
|
if !cx.generics.expect("method must have generics").ty_params.is_empty() {
|
||||||
//if !sig.generics.ty_params.is_empty() {
|
// when the result of `new()` depends on a type parameter we should not require
|
||||||
// // when the result of `new()` depends on a type parameter we should not require
|
// an
|
||||||
// // an
|
// impl of `Default`
|
||||||
// // impl of `Default`
|
return;
|
||||||
// return;
|
}
|
||||||
//}
|
|
||||||
if decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) {
|
if decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) {
|
||||||
let self_ty = cx.tcx
|
let self_ty = cx.tcx
|
||||||
.type_of(cx.tcx.hir.local_def_id(cx.tcx.hir.get_parent(id)));
|
.type_of(cx.tcx.hir.local_def_id(cx.tcx.hir.get_parent(id)));
|
||||||
|
|
|
@ -39,12 +39,6 @@ error: generally you want to avoid `&mut &mut _` if possible
|
||||||
30 | let y : &mut &mut u32 = &mut &mut 2;
|
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
|
error: generally you want to avoid `&mut &mut _` if possible
|
||||||
--> $DIR/mut_mut.rs:35:38
|
--> $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;
|
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;
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue