Skip to content

Commit

Permalink
Fix and bless clippy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Apr 24, 2024
1 parent cfee72a commit 9d16364
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 79 deletions.
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:27:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:26:5
|
LL | x[index];
| ^^^^^^^^
Expand All @@ -9,39 +9,39 @@ LL | x[index];
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`

error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:42:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:41:5
|
LL | v[0];
| ^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:43:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:42:5
|
LL | v[10];
| ^^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:44:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:43:5
|
LL | v[1 << 3];
| ^^^^^^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:50:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:49:5
|
LL | v[N];
| ^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead

error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:51:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:50:5
|
LL | v[M];
| ^^^^
Expand Down
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 @@ -10,7 +10,7 @@
arithmetic_overflow,
unconditional_panic
)]
#![feature(const_mut_refs, inline_const)]
#![feature(const_mut_refs)]
#![warn(clippy::arithmetic_side_effects)]

extern crate proc_macro_derive;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/bool_to_int_with_if.fixed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(let_chains, inline_const)]
#![feature(let_chains)]
#![warn(clippy::bool_to_int_with_if)]
#![allow(unused, dead_code, clippy::unnecessary_operation, clippy::no_effect)]

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/bool_to_int_with_if.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(let_chains, inline_const)]
#![feature(let_chains)]
#![warn(clippy::bool_to_int_with_if)]
#![allow(unused, dead_code, clippy::unnecessary_operation, clippy::no_effect)]

Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/tests/ui/const_is_empty.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(inline_const)]
#![warn(clippy::const_is_empty)]
#![allow(clippy::needless_late_init, unused_must_use)]

Expand Down
52 changes: 26 additions & 26 deletions src/tools/clippy/tests/ui/const_is_empty.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:6:8
--> tests/ui/const_is_empty.rs:5:8
|
LL | if "".is_empty() {
| ^^^^^^^^^^^^^
Expand All @@ -8,151 +8,151 @@ LL | if "".is_empty() {
= help: to override `-D warnings` add `#[allow(clippy::const_is_empty)]`

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:9:8
--> tests/ui/const_is_empty.rs:8:8
|
LL | if "foobar".is_empty() {
| ^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:15:8
--> tests/ui/const_is_empty.rs:14:8
|
LL | if b"".is_empty() {
| ^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:18:8
--> tests/ui/const_is_empty.rs:17:8
|
LL | if b"foobar".is_empty() {
| ^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:35:8
--> tests/ui/const_is_empty.rs:34:8
|
LL | if empty2.is_empty() {
| ^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:38:8
--> tests/ui/const_is_empty.rs:37:8
|
LL | if non_empty2.is_empty() {
| ^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:60:13
--> tests/ui/const_is_empty.rs:59:13
|
LL | let _ = EMPTY_STR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:62:13
--> tests/ui/const_is_empty.rs:61:13
|
LL | let _ = NON_EMPTY_STR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:64:13
--> tests/ui/const_is_empty.rs:63:13
|
LL | let _ = EMPTY_BSTR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:66:13
--> tests/ui/const_is_empty.rs:65:13
|
LL | let _ = NON_EMPTY_BSTR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:68:13
--> tests/ui/const_is_empty.rs:67:13
|
LL | let _ = EMPTY_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:70:13
--> tests/ui/const_is_empty.rs:69:13
|
LL | let _ = EMPTY_ARRAY_REPEAT.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:72:13
--> tests/ui/const_is_empty.rs:71:13
|
LL | let _ = EMPTY_U8_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:74:13
--> tests/ui/const_is_empty.rs:73:13
|
LL | let _ = NON_EMPTY_U8_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:76:13
--> tests/ui/const_is_empty.rs:75:13
|
LL | let _ = NON_EMPTY_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:78:13
--> tests/ui/const_is_empty.rs:77:13
|
LL | let _ = NON_EMPTY_ARRAY_REPEAT.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:80:13
--> tests/ui/const_is_empty.rs:79:13
|
LL | let _ = EMPTY_REF_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:82:13
--> tests/ui/const_is_empty.rs:81:13
|
LL | let _ = NON_EMPTY_REF_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:84:13
--> tests/ui/const_is_empty.rs:83:13
|
LL | let _ = EMPTY_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:86:13
--> tests/ui/const_is_empty.rs:85:13
|
LL | let _ = NON_EMPTY_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:88:13
--> tests/ui/const_is_empty.rs:87:13
|
LL | let _ = NON_EMPTY_SLICE_REPEAT.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:94:13
--> tests/ui/const_is_empty.rs:93:13
|
LL | let _ = value.is_empty();
| ^^^^^^^^^^^^^^^^

error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:97:13
--> tests/ui/const_is_empty.rs:96:13
|
LL | let _ = x.is_empty();
| ^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:99:13
--> tests/ui/const_is_empty.rs:98:13
|
LL | let _ = "".is_empty();
| ^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:101:13
--> tests/ui/const_is_empty.rs:100:13
|
LL | let _ = b"".is_empty();
| ^^^^^^^^^^^^^^

error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:155:13
--> tests/ui/const_is_empty.rs:154:13
|
LL | let _ = val.is_empty();
| ^^^^^^^^^^^^^^
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,6 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes

#![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
Loading

0 comments on commit 9d16364

Please sign in to comment.