Skip to content

Commit 4e0a346

Browse files
committed
fix vec.rs test, comment
1 parent 1317378 commit 4e0a346

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

clippy_lints/src/loops/never_loop.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,9 @@ fn never_loop_expr<'tcx>(
275275
let Some(macro_call) = root_macro_call_first_node(cx, expr) &&
276276
let Some(sym::todo_macro) = cx.tcx.get_diagnostic_name(macro_call.def_id)
277277
{
278-
// We return MayContinueMainLoop here because we treat `todo!()` and
279-
// `unimplemented!()` macros as potentially containing any code,
280-
// including a continue of the main loop. This effectively silences the lint
281-
// whenever a loop contains one of these macros anywhere.
278+
// We return MayContinueMainLoop here because we treat `todo!()`
279+
// as potentially containing any code, including a continue of the main loop.
280+
// This effectively silences the lint whenever a loop contains this macro anywhere.
282281
NeverLoopResult::MayContinueMainLoop
283282
} else {
284283
result

tests/ui/vec.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ fn issue11075() {
120120
stringify!($e)
121121
};
122122
}
123+
#[allow(clippy::never_loop)]
123124
for _string in [repro!(true), repro!(null)] {
124125
unimplemented!();
125126
}

tests/ui/vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ fn issue11075() {
120120
stringify!($e)
121121
};
122122
}
123+
#[allow(clippy::never_loop)]
123124
for _string in vec![repro!(true), repro!(null)] {
124125
unimplemented!();
125126
}

tests/ui/vec.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,31 @@ LL | for _ in vec![1, 2, 3] {}
8585
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
8686

8787
error: useless use of `vec!`
88-
--> $DIR/vec.rs:123:20
88+
--> $DIR/vec.rs:124:20
8989
|
9090
LL | for _string in vec![repro!(true), repro!(null)] {
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[repro!(true), repro!(null)]`
9292

9393
error: useless use of `vec!`
94-
--> $DIR/vec.rs:140:18
94+
--> $DIR/vec.rs:141:18
9595
|
9696
LL | in_macro!(1, vec![1, 2], vec![1; 2]);
9797
| ^^^^^^^^^^ help: you can use an array directly: `[1, 2]`
9898

9999
error: useless use of `vec!`
100-
--> $DIR/vec.rs:140:30
100+
--> $DIR/vec.rs:141:30
101101
|
102102
LL | in_macro!(1, vec![1, 2], vec![1; 2]);
103103
| ^^^^^^^^^^ help: you can use an array directly: `[1; 2]`
104104

105105
error: useless use of `vec!`
106-
--> $DIR/vec.rs:159:14
106+
--> $DIR/vec.rs:160:14
107107
|
108108
LL | for a in vec![1, 2, 3] {
109109
| ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
110110

111111
error: useless use of `vec!`
112-
--> $DIR/vec.rs:163:14
112+
--> $DIR/vec.rs:164:14
113113
|
114114
LL | for a in vec![String::new(), String::new()] {
115115
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[String::new(), String::new()]`

0 commit comments

Comments
 (0)