Skip to content

Commit

Permalink
Fix clippy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Nov 7, 2022
1 parent 1ff6551 commit 39c3558
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/arithmetic_side_effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
arithmetic_overflow,
unconditional_panic
)]
#![feature(const_mut_refs, inline_const, saturating_int_impl)]
#![feature(const_mut_refs, saturating_int_impl)]
#![warn(clippy::arithmetic_side_effects)]

use core::num::{Saturating, Wrapping};
Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/tests/ui/indexing_slicing_index.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(inline_const)]
#![warn(clippy::indexing_slicing)]
// We also check the out_of_bounds_indexing lint here, because it lints similar things and
// we want to avoid false positives.
Expand Down
18 changes: 9 additions & 9 deletions src/tools/clippy/tests/ui/indexing_slicing_index.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error[E0080]: evaluation of `main::{constant#3}` failed
--> $DIR/indexing_slicing_index.rs:31:14
--> $DIR/indexing_slicing_index.rs:30:14
|
LL | const { &ARR[idx4()] }; // Ok, let rustc handle const contexts.
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4

error[E0080]: erroneous constant used
--> $DIR/indexing_slicing_index.rs:31:5
--> $DIR/indexing_slicing_index.rs:30:5
|
LL | const { &ARR[idx4()] }; // Ok, let rustc handle const contexts.
| ^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors

error: indexing may panic
--> $DIR/indexing_slicing_index.rs:22:5
--> $DIR/indexing_slicing_index.rs:21:5
|
LL | x[index];
| ^^^^^^^^
Expand All @@ -20,47 +20,47 @@ LL | x[index];
= note: `-D clippy::indexing-slicing` implied by `-D warnings`

error: indexing may panic
--> $DIR/indexing_slicing_index.rs:38:5
--> $DIR/indexing_slicing_index.rs:37:5
|
LL | v[0];
| ^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> $DIR/indexing_slicing_index.rs:39:5
--> $DIR/indexing_slicing_index.rs:38:5
|
LL | v[10];
| ^^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> $DIR/indexing_slicing_index.rs:40:5
--> $DIR/indexing_slicing_index.rs:39:5
|
LL | v[1 << 3];
| ^^^^^^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> $DIR/indexing_slicing_index.rs:46:5
--> $DIR/indexing_slicing_index.rs:45:5
|
LL | v[N];
| ^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> $DIR/indexing_slicing_index.rs:47:5
--> $DIR/indexing_slicing_index.rs:46:5
|
LL | v[M];
| ^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error[E0080]: evaluation of constant value failed
--> $DIR/indexing_slicing_index.rs:10:24
--> $DIR/indexing_slicing_index.rs:9:24
|
LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/tests/ui/panicking_macros.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(clippy::assertions_on_constants, clippy::eq_op, clippy::let_unit_value)]
#![feature(inline_const)]
#![warn(clippy::unimplemented, clippy::unreachable, clippy::todo, clippy::panic)]

extern crate core;
Expand Down
32 changes: 16 additions & 16 deletions src/tools/clippy/tests/ui/panicking_macros.stderr
Original file line number Diff line number Diff line change
@@ -1,103 +1,103 @@
error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:23:5
--> $DIR/panicking_macros.rs:22:5
|
LL | panic!();
| ^^^^^^^^
|
= note: `-D clippy::panic` implied by `-D warnings`

error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:24:5
--> $DIR/panicking_macros.rs:23:5
|
LL | panic!("message");
| ^^^^^^^^^^^^^^^^^

error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:25:5
--> $DIR/panicking_macros.rs:24:5
|
LL | panic!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:31:5
--> $DIR/panicking_macros.rs:30:5
|
LL | todo!();
| ^^^^^^^
|
= note: `-D clippy::todo` implied by `-D warnings`

error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:32:5
--> $DIR/panicking_macros.rs:31:5
|
LL | todo!("message");
| ^^^^^^^^^^^^^^^^

error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:33:5
--> $DIR/panicking_macros.rs:32:5
|
LL | todo!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:39:5
--> $DIR/panicking_macros.rs:38:5
|
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unimplemented` implied by `-D warnings`

error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:40:5
--> $DIR/panicking_macros.rs:39:5
|
LL | unimplemented!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:41:5
--> $DIR/panicking_macros.rs:40:5
|
LL | unimplemented!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:47:5
--> $DIR/panicking_macros.rs:46:5
|
LL | unreachable!();
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::unreachable` implied by `-D warnings`

error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:48:5
--> $DIR/panicking_macros.rs:47:5
|
LL | unreachable!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^

error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:49:5
--> $DIR/panicking_macros.rs:48:5
|
LL | unreachable!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:55:5
--> $DIR/panicking_macros.rs:54:5
|
LL | panic!();
| ^^^^^^^^

error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:56:5
--> $DIR/panicking_macros.rs:55:5
|
LL | todo!();
| ^^^^^^^

error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:57:5
--> $DIR/panicking_macros.rs:56:5
|
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^

error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:58:5
--> $DIR/panicking_macros.rs:57:5
|
LL | unreachable!();
| ^^^^^^^^^^^^^^
Expand Down

0 comments on commit 39c3558

Please sign in to comment.