new_ret_no_self fix false positive for impl trait return with associated type self

This commit is contained in:
Josh Mcguigan 2018-10-03 04:59:14 -07:00
parent 13ce96c4bf
commit 1c4fa419f3
3 changed files with 25 additions and 9 deletions

View file

@ -934,7 +934,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
if let hir::ImplItemKind::Method(ref sig, id) = implitem.node {
let ret_ty = return_ty(cx, implitem.id);
if name == "new" &&
!ret_ty.walk().any(|t| same_tys(cx, t, ty)) {
!same_tys(cx, ret_ty, ty) &&
!ret_ty.is_impl_trait() {
span_lint(cx,
NEW_RET_NO_SELF,
implitem.span,