Auto merge of #4937 - mikerite:fix-4824, r=phansch
Fix `map_clone` false positive Don't lint when the item type is not a reference. `copied` only applies to references. changelog: Fix `map_clone` false positive
This commit is contained in:
commit
8723eb6035
3 changed files with 24 additions and 2 deletions
|
|
@ -69,8 +69,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MapClone {
|
|||
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, .., name, None) => {
|
||||
match closure_expr.kind {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref inner) => {
|
||||
if ident_eq(name, inner) && !cx.tables.expr_ty(inner).is_box() {
|
||||
lint(cx, e.span, args[0].span, true);
|
||||
if ident_eq(name, inner) {
|
||||
if let ty::Ref(..) = cx.tables.expr_ty(inner).kind {
|
||||
lint(cx, e.span, args[0].span, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
hir::ExprKind::MethodCall(ref method, _, ref obj) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue