mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
fix vec.rs test, comment
This commit is contained in:
parent
1317378b9e
commit
4e0a3465d1
4 changed files with 10 additions and 9 deletions
|
@ -275,10 +275,9 @@ fn never_loop_expr<'tcx>(
|
|||
let Some(macro_call) = root_macro_call_first_node(cx, expr) &&
|
||||
let Some(sym::todo_macro) = cx.tcx.get_diagnostic_name(macro_call.def_id)
|
||||
{
|
||||
// We return MayContinueMainLoop here because we treat `todo!()` and
|
||||
// `unimplemented!()` macros as potentially containing any code,
|
||||
// including a continue of the main loop. This effectively silences the lint
|
||||
// whenever a loop contains one of these macros anywhere.
|
||||
// We return MayContinueMainLoop here because we treat `todo!()`
|
||||
// as potentially containing any code, including a continue of the main loop.
|
||||
// This effectively silences the lint whenever a loop contains this macro anywhere.
|
||||
NeverLoopResult::MayContinueMainLoop
|
||||
} else {
|
||||
result
|
||||
|
|
|
@ -120,6 +120,7 @@ fn issue11075() {
|
|||
stringify!($e)
|
||||
};
|
||||
}
|
||||
#[allow(clippy::never_loop)]
|
||||
for _string in [repro!(true), repro!(null)] {
|
||||
unimplemented!();
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@ fn issue11075() {
|
|||
stringify!($e)
|
||||
};
|
||||
}
|
||||
#[allow(clippy::never_loop)]
|
||||
for _string in vec![repro!(true), repro!(null)] {
|
||||
unimplemented!();
|
||||
}
|
||||
|
|
|
@ -85,31 +85,31 @@ LL | for _ in vec![1, 2, 3] {}
|
|||
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:123:20
|
||||
--> $DIR/vec.rs:124:20
|
||||
|
|
||||
LL | for _string in vec![repro!(true), repro!(null)] {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[repro!(true), repro!(null)]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:140:18
|
||||
--> $DIR/vec.rs:141:18
|
||||
|
|
||||
LL | in_macro!(1, vec![1, 2], vec![1; 2]);
|
||||
| ^^^^^^^^^^ help: you can use an array directly: `[1, 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:140:30
|
||||
--> $DIR/vec.rs:141:30
|
||||
|
|
||||
LL | in_macro!(1, vec![1, 2], vec![1; 2]);
|
||||
| ^^^^^^^^^^ help: you can use an array directly: `[1; 2]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:159:14
|
||||
--> $DIR/vec.rs:160:14
|
||||
|
|
||||
LL | for a in vec![1, 2, 3] {
|
||||
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
|
||||
|
||||
error: useless use of `vec!`
|
||||
--> $DIR/vec.rs:163:14
|
||||
--> $DIR/vec.rs:164:14
|
||||
|
|
||||
LL | for a in vec![String::new(), String::new()] {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[String::new(), String::new()]`
|
||||
|
|
Loading…
Reference in a new issue