]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/misc_early.rs
Fix warnings
[rust.git] / clippy_lints / src / misc_early.rs
index fcd88f9f21906cf21ae3e3418ffc684750238bf3..96a3250d272cc3f0ac91608d7d389c91b1977374 100644 (file)
@@ -189,13 +189,13 @@ fn get_lints(&self) -> LintArray {
 impl EarlyLintPass for MiscEarly {
     fn check_generics(&mut self, cx: &EarlyContext, gen: &Generics) {
         for param in &gen.params {
-            if let GenericParam::Type(ref ty) = *param {
-                let name = ty.ident.name.as_str();
+            if let GenericParamKind::Type { .. } = param.kind {
+                let name = param.ident.name.as_str();
                 if constants::BUILTIN_TYPES.contains(&&*name) {
                     span_lint(
                         cx,
                         BUILTIN_TYPE_SHADOW,
-                        ty.ident.span,
+                        param.ident.span,
                         &format!("This generic shadows the built-in type `{}`", name),
                     );
                 }
@@ -296,7 +296,7 @@ fn check_expr(&mut self, cx: &EarlyContext, expr: &Expr) {
         }
         match expr.node {
             ExprKind::Call(ref paren, _) => if let ExprKind::Paren(ref closure) = paren.node {
-                if let ExprKind::Closure(_, _, ref decl, ref block, _) = closure.node {
+                if let ExprKind::Closure(_, _, _, ref decl, ref block, _) = closure.node {
                     span_lint_and_then(
                         cx,
                         REDUNDANT_CLOSURE_CALL,
@@ -327,7 +327,7 @@ fn check_block(&mut self, cx: &EarlyContext, block: &Block) {
             if_chain! {
                 if let StmtKind::Local(ref local) = w[0].node;
                 if let Option::Some(ref t) = local.init;
-                if let ExprKind::Closure(_, _, _, _, _) = t.node;
+                if let ExprKind::Closure(..) = t.node;
                 if let PatKind::Ident(_, ident, _) = local.pat.node;
                 if let StmtKind::Semi(ref second) = w[1].node;
                 if let ExprKind::Assign(_, ref call) = second.node;
@@ -371,8 +371,8 @@ fn check_lit(self, cx: &EarlyContext, lit: &Lit) {
                     let mut seen = (false, false);
                     for ch in src.chars() {
                         match ch {
-                            'a' ... 'f' => seen.0 = true,
-                            'A' ... 'F' => seen.1 = true,
+                            'a' ..= 'f' => seen.0 = true,
+                            'A' ..= 'F' => seen.1 = true,
                             'i' | 'u'   => break,   // start of suffix already
                             _ => ()
                         }