]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/misc.rs
Update for rustc 1.19.0-nightly (4bf5c99af 2017-06-10).
[rust.git] / clippy_lints / src / misc.rs
index dbadce6193cd1cf596f5611f0c8c88d949de16c6..fda048110fe4641e460adfb108677fc458a20477 100644 (file)
@@ -455,18 +455,23 @@ fn check_to_owned(cx: &LateContext, expr: &Expr, other: &Expr) {
     // *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);
@@ -474,7 +479,8 @@ fn check_to_owned(cx: &LateContext, expr: &Expr, other: &Expr) {
             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;
                     }