about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJonas Schievink <jonas@schievink.net>2016-02-09 21:39:09 +0100
committerJonas Schievink <jonas@schievink.net>2016-02-12 19:28:42 +0100
commitfbeb67985df7fadfb01dd2e3b0defe2fa0dfd9d4 (patch)
tree855040fce560c7af7a7cb0dd9c9ddde4498052c9 /src
parent65b38f304d63a39d1a03a09381135d399c2f4e78 (diff)
downloadrust-fbeb67985df7fadfb01dd2e3b0defe2fa0dfd9d4.tar.gz
rust-fbeb67985df7fadfb01dd2e3b0defe2fa0dfd9d4.zip
Autoderef in librustc_lint
Diffstat (limited to 'src')
-rw-r--r--src/librustc_lint/types.rs14
-rw-r--r--src/librustc_lint/unused.rs18
2 files changed, 16 insertions, 16 deletions
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs
index 9fe1aa15f4a..203f6626f51 100644
--- a/src/librustc_lint/types.rs
+++ b/src/librustc_lint/types.rs
@@ -125,7 +125,7 @@ impl LateLintPass for TypeLimits {
                 }
             },
             hir::ExprBinary(binop, ref l, ref r) => {
-                if is_comparison(binop) && !check_limits(cx.tcx, binop, &**l, &**r) {
+                if is_comparison(binop) && !check_limits(cx.tcx, binop, &l, &r) {
                     cx.span_lint(UNUSED_COMPARISONS, e.span,
                                  "comparison is useless due to type limits");
                 }
@@ -174,7 +174,7 @@ impl LateLintPass for TypeLimits {
                                 if (negative && v > max as u64 + 1) ||
                                    (!negative && v > max as u64) {
                                     cx.span_lint(OVERFLOWING_LITERALS, e.span,
-                                                 &*format!("literal out of range for {:?}", t));
+                                                 &format!("literal out of range for {:?}", t));
                                     return;
                                 }
                             }
@@ -196,7 +196,7 @@ impl LateLintPass for TypeLimits {
                         };
                         if lit_val < min || lit_val > max {
                             cx.span_lint(OVERFLOWING_LITERALS, e.span,
-                                         &*format!("literal out of range for {:?}", t));
+                                         &format!("literal out of range for {:?}", t));
                         }
                     },
                     ty::TyFloat(t) => {
@@ -213,7 +213,7 @@ impl LateLintPass for TypeLimits {
                         };
                         if lit_val < min || lit_val > max {
                             cx.span_lint(OVERFLOWING_LITERALS, e.span,
-                                         &*format!("literal out of range for {:?}", t));
+                                         &format!("literal out of range for {:?}", t));
                         }
                     },
                     _ => ()
@@ -666,7 +666,7 @@ impl LateLintPass for ImproperCTypes {
 
         fn check_foreign_fn(cx: &LateContext, decl: &hir::FnDecl) {
             for input in &decl.inputs {
-                check_ty(cx, &*input.ty);
+                check_ty(cx, &input.ty);
             }
             if let hir::Return(ref ret_ty) = decl.output {
                 let tty = ast_ty_to_normalized(cx.tcx, ret_ty.id);
@@ -680,8 +680,8 @@ impl LateLintPass for ImproperCTypes {
             if nmod.abi != Abi::RustIntrinsic && nmod.abi != Abi::PlatformIntrinsic {
                 for ni in &nmod.items {
                     match ni.node {
-                        hir::ForeignItemFn(ref decl, _) => check_foreign_fn(cx, &**decl),
-                        hir::ForeignItemStatic(ref t, _) => check_ty(cx, &**t)
+                        hir::ForeignItemFn(ref decl, _) => check_foreign_fn(cx, &decl),
+                        hir::ForeignItemStatic(ref t, _) => check_ty(cx, &t)
                     }
                 }
             }
diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs
index f18b68a5b73..36ed06a6c00 100644
--- a/src/librustc_lint/unused.rs
+++ b/src/librustc_lint/unused.rs
@@ -248,7 +248,7 @@ impl LateLintPass for UnusedAttributes {
 
         let plugin_attributes = cx.sess().plugin_attributes.borrow_mut();
         for &(ref name, ty) in plugin_attributes.iter() {
-            if ty == AttributeType::Whitelisted && attr.check_name(&*name) {
+            if ty == AttributeType::Whitelisted && attr.check_name(&name) {
                 break;
             }
         }
@@ -265,7 +265,7 @@ impl LateLintPass for UnusedAttributes {
             // the crate level?
             let plugin_crate = plugin_attributes.iter()
                                                 .find(|&&(ref x, t)| {
-                                                        &*attr.name() == &*x &&
+                                                        &*attr.name() == x &&
                                                         AttributeType::CrateLevel == t
                                                     }).is_some();
             if  known_crate || plugin_crate {
@@ -294,7 +294,7 @@ impl UnusedParens {
     fn check_unused_parens_core(&self, cx: &EarlyContext, value: &ast::Expr, msg: &str,
                                 struct_lit_needs_parens: bool) {
         if let ast::ExprKind::Paren(ref inner) = value.node {
-            let necessary = struct_lit_needs_parens && contains_exterior_struct_lit(&**inner);
+            let necessary = struct_lit_needs_parens && contains_exterior_struct_lit(&inner);
             if !necessary {
                 cx.span_lint(UNUSED_PARENS, value.span,
                              &format!("unnecessary parentheses around {}", msg))
@@ -314,8 +314,8 @@ impl UnusedParens {
                 ast::ExprKind::AssignOp(_, ref lhs, ref rhs) |
                 ast::ExprKind::Binary(_, ref lhs, ref rhs) => {
                     // X { y: 1 } + X { y: 2 }
-                    contains_exterior_struct_lit(&**lhs) ||
-                        contains_exterior_struct_lit(&**rhs)
+                    contains_exterior_struct_lit(&lhs) ||
+                        contains_exterior_struct_lit(&rhs)
                 }
                 ast::ExprKind::Unary(_, ref x) |
                 ast::ExprKind::Cast(ref x, _) |
@@ -324,12 +324,12 @@ impl UnusedParens {
                 ast::ExprKind::TupField(ref x, _) |
                 ast::ExprKind::Index(ref x, _) => {
                     // &X { y: 1 }, X { y: 1 }.y
-                    contains_exterior_struct_lit(&**x)
+                    contains_exterior_struct_lit(&x)
                 }
 
                 ast::ExprKind::MethodCall(_, _, ref exprs) => {
                     // X { y: 1 }.bar(...)
-                    contains_exterior_struct_lit(&*exprs[0])
+                    contains_exterior_struct_lit(&exprs[0])
                 }
 
                 _ => false
@@ -360,7 +360,7 @@ impl EarlyLintPass for UnusedParens {
             InPlace(_, ref value) => (value, "emplacement value", false),
             _ => return
         };
-        self.check_unused_parens_core(cx, &**value, msg, struct_lit_needs_parens);
+        self.check_unused_parens_core(cx, &value, msg, struct_lit_needs_parens);
     }
 
     fn check_stmt(&mut self, cx: &EarlyContext, s: &ast::Stmt) {
@@ -374,7 +374,7 @@ impl EarlyLintPass for UnusedParens {
             },
             _ => return
         };
-        self.check_unused_parens_core(cx, &**value, msg, false);
+        self.check_unused_parens_core(cx, &value, msg, false);
     }
 }