let def = cx.tcx.def_map.borrow().get(&p.id).map(|d| d.full_def());
if let Some(DefLocal(..)) = def {
if edef.variants.iter().any(|variant|
- variant.name == ident.node.name
+ variant.name == ident.node.unhygienic_name
&& variant.kind() == VariantKind::Unit
) {
+ let ty_path = cx.tcx.item_path_str(edef.did);
span_warn!(cx.tcx.sess, p.span, E0170,
"pattern binding `{}` is named the same as one \
of the variants of the type `{}`",
- ident.node, pat_ty);
+ ident.node, ty_path);
fileline_help!(cx.tcx.sess, p.span,
"if you meant to match on a variant, \
consider making the path in the pattern qualified: `{}::{}`",
- pat_ty, ident.node);
+ ty_path, ident.node);
}
}
}
}
};
head.map(|mut head| {
- head.push_all(&r[..col]);
- head.push_all(&r[col + 1..]);
+ head.extend_from_slice(&r[..col]);
+ head.extend_from_slice(&r[col + 1..]);
head
})
}