This commit is contained in:
mcarton 2016-06-29 22:35:58 +02:00
parent 7a1fc9fce5
commit a3c505551f
No known key found for this signature in database
GPG Key ID: 5E427C794CBA45E8

View 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,