From: mcarton Date: Wed, 29 Jun 2016 20:35:58 +0000 (+0200) Subject: Cleanup X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=a3c505551fc1d5ed4270357e6a616b01b45e9a7d;p=rust.git Cleanup --- diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index a959dbe1d6a..8a1ebd162af 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -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,