// *arg impls PartialEq<other>
if !arg_ty
.builtin_deref(true, ty::LvaluePreference::NoPreference)
- .map_or(false, |tam| implements_trait(cx, tam.ty, partial_eq_trait_id, &[other_ty], None))
+ .map_or(false, |tam| implements_trait(cx, tam.ty, partial_eq_trait_id, &[other_ty]))
// arg impls PartialEq<*other>
&& !other_ty
.builtin_deref(true, ty::LvaluePreference::NoPreference)
- .map_or(false, |tam| implements_trait(cx, arg_ty, partial_eq_trait_id, &[tam.ty], None))
+ .map_or(false, |tam| implements_trait(cx, arg_ty, partial_eq_trait_id, &[tam.ty]))
// arg impls PartialEq<other>
- && !implements_trait(cx, arg_ty, partial_eq_trait_id, &[other_ty], None) {
+ && !implements_trait(cx, arg_ty, partial_eq_trait_id, &[other_ty]) {
return;
}
- span_lint_and_then(cx, CMP_OWNED, expr.span, "this creates an owned instance just for comparison", |db| {
- // this is as good as our recursion check can get, we can't prove that the current function is called by
+ span_lint_and_then(cx,
+ CMP_OWNED,
+ expr.span,
+ "this creates an owned instance just for comparison",
+ |db| {
+ // this is as good as our recursion check can get, we can't prove that the current function is
+ // called by
// PartialEq::eq, but we can at least ensure that this code is not part of it
let parent_fn = cx.tcx.hir.get_parent(expr.id);
let parent_impl = cx.tcx.hir.get_parent(parent_fn);
if let map::NodeItem(item) = cx.tcx.hir.get(parent_impl) {
if let ItemImpl(.., Some(ref trait_ref), _, _) = item.node {
if trait_ref.path.def.def_id() == partial_eq_trait_id {
- // we are implementing PartialEq, don't suggest not doing `to_owned`, otherwise we go into recursion
+ // we are implementing PartialEq, don't suggest not doing `to_owned`, otherwise we go into
+ // recursion
db.span_label(expr.span, "try calling implementing the comparison without allocating");
return;
}