diff options
| author | Mario Carneiro <di.gama@gmail.com> | 2023-09-04 06:35:51 +0200 |
|---|---|---|
| committer | Mario Carneiro <di.gama@gmail.com> | 2023-09-04 06:35:51 +0200 |
| commit | 4e0a3465d1cf3f7fee92168deef9668508d5b400 (patch) | |
| tree | f0d559e61a929013ff458b1b1baf38e7af7d3057 | |
| parent | 1317378b9e31306f45ece0be21104a798b4ba73c (diff) | |
| download | rust-4e0a3465d1cf3f7fee92168deef9668508d5b400.tar.gz rust-4e0a3465d1cf3f7fee92168deef9668508d5b400.zip | |
fix vec.rs test, comment
| -rw-r--r-- | clippy_lints/src/loops/never_loop.rs | 7 | ||||
| -rw-r--r-- | tests/ui/vec.fixed | 1 | ||||
| -rw-r--r-- | tests/ui/vec.rs | 1 | ||||
| -rw-r--r-- | tests/ui/vec.stderr | 10 |
4 files changed, 10 insertions, 9 deletions
diff --git a/clippy_lints/src/loops/never_loop.rs b/clippy_lints/src/loops/never_loop.rs index 7b27c4132de..3d8a4cd948a 100644 --- a/clippy_lints/src/loops/never_loop.rs +++ b/clippy_lints/src/loops/never_loop.rs @@ -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 diff --git a/tests/ui/vec.fixed b/tests/ui/vec.fixed index 3ff2acbe28f..bcbca971a78 100644 --- a/tests/ui/vec.fixed +++ b/tests/ui/vec.fixed @@ -120,6 +120,7 @@ fn issue11075() { stringify!($e) }; } + #[allow(clippy::never_loop)] for _string in [repro!(true), repro!(null)] { unimplemented!(); } diff --git a/tests/ui/vec.rs b/tests/ui/vec.rs index 2ab025f424a..087425585de 100644 --- a/tests/ui/vec.rs +++ b/tests/ui/vec.rs @@ -120,6 +120,7 @@ fn issue11075() { stringify!($e) }; } + #[allow(clippy::never_loop)] for _string in vec![repro!(true), repro!(null)] { unimplemented!(); } diff --git a/tests/ui/vec.stderr b/tests/ui/vec.stderr index 5cd6d9fa8c7..a133b4041d4 100644 --- a/tests/ui/vec.stderr +++ b/tests/ui/vec.stderr @@ -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()]` |
