]> git.lizzy.rs Git - rust.git/commitdiff
Cleanup
authormcarton <cartonmartin+git@gmail.com>
Wed, 29 Jun 2016 20:35:58 +0000 (22:35 +0200)
committermcarton <cartonmartin+git@gmail.com>
Fri, 1 Jul 2016 15:12:48 +0000 (17:12 +0200)
clippy_lints/src/methods.rs

index a959dbe1d6ad73cda909d47fde2070069821b5c5..8a1ebd162af8b2a9f4e6f0b81dcb3a0903b00c8c 100644 (file)
@@ -672,20 +672,20 @@ fn lint_cstring_as_ptr(cx: &LateContext, expr: &hir::Expr, new: &hir::Expr, unwr
 #[allow(ptr_arg)]
 // Type of MethodArgs is potentially a Vec
 fn lint_iter_nth(cx: &LateContext, expr: &hir::Expr, iter_args: &MethodArgs, is_mut: bool){
-    let caller_type;
     let mut_str = if is_mut { "_mut" } else {""};
-    if let Some(_) = derefs_to_slice(cx, &iter_args[0], &cx.tcx.expr_ty(&iter_args[0])) {
-        caller_type = "slice";
+    let caller_type = if let Some(_) = derefs_to_slice(cx, &iter_args[0], &cx.tcx.expr_ty(&iter_args[0])) {
+        "slice"
     }
     else if match_type(cx, cx.tcx.expr_ty(&iter_args[0]), &paths::VEC) {
-        caller_type = "Vec";
+        "Vec"
     }
     else if match_type(cx, cx.tcx.expr_ty(&iter_args[0]), &paths::VEC_DEQUE) {
-        caller_type = "VecDeque";
+        "VecDeque"
     }
     else {
         return; // caller is not a type that we want to lint
-    }
+    };
+
     span_lint(
         cx,
         ITER_NTH,