]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/unused.rs
preserve order if blocks are between items
[rust.git] / src / librustc_lint / unused.rs
index 958f97d87cb89d8d87aa09743ca546cbd95482af..da291f56ee4e56ce175817dc7f1c42caf02e100f 100644 (file)
@@ -102,16 +102,29 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
             // attribute which does exist on the comparison trait methods
             hir::ExprKind::Binary(bin_op, ..)  => {
                 match bin_op.node {
-                    hir::BinOpKind::Eq | hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Ne | hir::BinOpKind::Ge | hir::BinOpKind::Gt => {
+                    hir::BinOpKind::Eq |
+                    hir::BinOpKind::Lt |
+                    hir::BinOpKind::Le |
+                    hir::BinOpKind::Ne |
+                    hir::BinOpKind::Ge |
+                    hir::BinOpKind::Gt => {
                         Some("comparison")
                     },
-                    hir::BinOpKind::Add | hir::BinOpKind::Sub | hir::BinOpKind::Div | hir::BinOpKind::Mul | hir::BinOpKind::Rem => {
+                    hir::BinOpKind::Add |
+                    hir::BinOpKind::Sub |
+                    hir::BinOpKind::Div |
+                    hir::BinOpKind::Mul |
+                    hir::BinOpKind::Rem => {
                         Some("arithmetic operation")
                     },
                     hir::BinOpKind::And | hir::BinOpKind::Or => {
                         Some("logical operation")
                     },
-                    hir::BinOpKind::BitXor | hir::BinOpKind::BitAnd | hir::BinOpKind::BitOr | hir::BinOpKind::Shl | hir::BinOpKind::Shr => {
+                    hir::BinOpKind::BitXor |
+                    hir::BinOpKind::BitAnd |
+                    hir::BinOpKind::BitOr |
+                    hir::BinOpKind::Shl |
+                    hir::BinOpKind::Shr => {
                         Some("bitwise operation")
                     },
                 }
@@ -133,7 +146,7 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
         fn check_must_use(cx: &LateContext, def_id: DefId, sp: Span, describe_path: &str) -> bool {
             for attr in cx.tcx.get_attrs(def_id).iter() {
                 if attr.check_name("must_use") {
-                    let mut msg = format!("unused {}`{}` which must be used",
+                    let msg = format!("unused {}`{}` which must be used",
                                           describe_path, cx.tcx.item_path_str(def_id));
                     let mut err = cx.struct_span_lint(UNUSED_MUST_USE, sp, &msg);
                     // check for #[must_use = "..."]