Update tests; make it work with generics on context

This commit is contained in:
Manish Goregaokar 2017-10-28 14:52:45 -04:00
parent b0616df931
commit 09143cdaf0
2 changed files with 6 additions and 31 deletions

View file

@ -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)));