cmp_owned correct error message if rhs is deref

This commit is contained in:
Josh Mcguigan
2018-10-12 04:34:41 -07:00
parent 0b65462ca5
commit c9718fa589
2 changed files with 6 additions and 2 deletions

View File

@@ -579,6 +579,10 @@ fn check_to_owned(cx: &LateContext<'_, '_>, expr: &Expr, other: &Expr) {
}
}
}
if other_gets_derefed {
db.span_label(lint_span, "try implementing the comparison without allocating");
return;
}
db.span_suggestion_with_applicability(
lint_span,
"try",