adjust messages in tests

This commit is contained in:
Oliver Schneider 2017-01-30 14:25:25 +01:00
parent c46178c518
commit 21a0b16aee
No known key found for this signature in database
GPG Key ID: A69F8D225B3AD7D9
2 changed files with 6 additions and 11 deletions

View File

@ -684,18 +684,13 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
lint_iter_method(cx, args, arg, method_name);
} else {
let object = snippet(cx, args[0].span, "_");
span_lint_and_then(cx,
span_lint_and_sugg(cx,
EXPLICIT_INTO_ITER_LOOP,
arg.span,
&format!("it is more idiomatic to loop over `{}` instead of `{}.{}()`",
object,
object,
method_name),
|db| {
db.span_suggestion(arg.span,
"to write this more concisely, try looping over",
object.to_string());
});
"it is more idiomatic to loop over containers instead of using explicit \
iteration methods`",
"to write this more concisely, try looping over",
object.to_string());
}
} else if method_name == "next" && match_trait_method(cx, arg, &paths::ITERATOR) {
span_lint(cx,

View File

@ -303,7 +303,7 @@ fn main() {
let array = [1, 2, 3];
for _v in array.into_iter() {} //~ERROR it is more idiomatic to loop over `&array`
for _v in array.into_iter() {}
for _v in &vec { } // these are fine
for _v in &mut vec { } // these are fine