Skip to content

Commit 05f78e5

Browse files
committed
allow the lint in a bunch of tests
1 parent 566a365 commit 05f78e5

File tree

139 files changed

+751
-551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+751
-551
lines changed

tests/ui-toml/suppress_lint_in_const/test.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
// We also check the out_of_bounds_indexing lint here, because it lints similar things and
44
// we want to avoid false positives.
55
#![warn(clippy::out_of_bounds_indexing)]
6-
#![allow(unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)]
6+
#![allow(
7+
unconditional_panic,
8+
clippy::no_effect,
9+
clippy::unnecessary_operation,
10+
clippy::useless_vec
11+
)]
712

813
const ARR: [i32; 2] = [1, 2];
914
const REF: &i32 = &ARR[idx()]; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.

tests/ui-toml/suppress_lint_in_const/test.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0080]: evaluation of `main::{constant#3}` failed
2-
--> $DIR/test.rs:31:14
2+
--> $DIR/test.rs:36:14
33
|
44
LL | const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
55
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
66

77
note: erroneous constant used
8-
--> $DIR/test.rs:31:5
8+
--> $DIR/test.rs:36:5
99
|
1010
LL | const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
1111
| ^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: indexing may panic
14-
--> $DIR/test.rs:22:5
14+
--> $DIR/test.rs:27:5
1515
|
1616
LL | x[index];
1717
| ^^^^^^^^
@@ -20,47 +20,47 @@ LL | x[index];
2020
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
2121

2222
error: indexing may panic
23-
--> $DIR/test.rs:38:5
23+
--> $DIR/test.rs:43:5
2424
|
2525
LL | v[0];
2626
| ^^^^
2727
|
2828
= help: consider using `.get(n)` or `.get_mut(n)` instead
2929

3030
error: indexing may panic
31-
--> $DIR/test.rs:39:5
31+
--> $DIR/test.rs:44:5
3232
|
3333
LL | v[10];
3434
| ^^^^^
3535
|
3636
= help: consider using `.get(n)` or `.get_mut(n)` instead
3737

3838
error: indexing may panic
39-
--> $DIR/test.rs:40:5
39+
--> $DIR/test.rs:45:5
4040
|
4141
LL | v[1 << 3];
4242
| ^^^^^^^^^
4343
|
4444
= help: consider using `.get(n)` or `.get_mut(n)` instead
4545

4646
error: indexing may panic
47-
--> $DIR/test.rs:46:5
47+
--> $DIR/test.rs:51:5
4848
|
4949
LL | v[N];
5050
| ^^^^
5151
|
5252
= help: consider using `.get(n)` or `.get_mut(n)` instead
5353

5454
error: indexing may panic
55-
--> $DIR/test.rs:47:5
55+
--> $DIR/test.rs:52:5
5656
|
5757
LL | v[M];
5858
| ^^^^
5959
|
6060
= help: consider using `.get(n)` or `.get_mut(n)` instead
6161

6262
error[E0080]: evaluation of constant value failed
63-
--> $DIR/test.rs:10:24
63+
--> $DIR/test.rs:15:24
6464
|
6565
LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
6666
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4

tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@compile-flags: --crate-name conf_disallowed_methods
22

33
#![warn(clippy::disallowed_methods)]
4+
#![allow(clippy::useless_vec)]
45

56
extern crate futures;
67
extern crate regex;

tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
11
error: use of a disallowed method `regex::Regex::new`
2-
--> $DIR/conf_disallowed_methods.rs:33:14
2+
--> $DIR/conf_disallowed_methods.rs:34:14
33
|
44
LL | let re = Regex::new(r"ab.*c").unwrap();
55
| ^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::disallowed-methods` implied by `-D warnings`
88

99
error: use of a disallowed method `regex::Regex::is_match`
10-
--> $DIR/conf_disallowed_methods.rs:34:5
10+
--> $DIR/conf_disallowed_methods.rs:35:5
1111
|
1212
LL | re.is_match("abc");
1313
| ^^^^^^^^^^^^^^^^^^
1414
|
1515
= note: no matching allowed (from clippy.toml)
1616

1717
error: use of a disallowed method `std::iter::Iterator::sum`
18-
--> $DIR/conf_disallowed_methods.rs:37:5
18+
--> $DIR/conf_disallowed_methods.rs:38:5
1919
|
2020
LL | a.iter().sum::<i32>();
2121
| ^^^^^^^^^^^^^^^^^^^^^
2222

2323
error: use of a disallowed method `slice::sort_unstable`
24-
--> $DIR/conf_disallowed_methods.rs:39:5
24+
--> $DIR/conf_disallowed_methods.rs:40:5
2525
|
2626
LL | a.sort_unstable();
2727
| ^^^^^^^^^^^^^^^^^
2828

2929
error: use of a disallowed method `f32::clamp`
30-
--> $DIR/conf_disallowed_methods.rs:41:13
30+
--> $DIR/conf_disallowed_methods.rs:42:13
3131
|
3232
LL | let _ = 2.0f32.clamp(3.0f32, 4.0f32);
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434

3535
error: use of a disallowed method `regex::Regex::new`
36-
--> $DIR/conf_disallowed_methods.rs:44:61
36+
--> $DIR/conf_disallowed_methods.rs:45:61
3737
|
3838
LL | let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new;
3939
| ^^^^^^^^^^
4040

4141
error: use of a disallowed method `f32::clamp`
42-
--> $DIR/conf_disallowed_methods.rs:47:28
42+
--> $DIR/conf_disallowed_methods.rs:48:28
4343
|
4444
LL | let in_call = Box::new(f32::clamp);
4545
| ^^^^^^^^^^
4646

4747
error: use of a disallowed method `regex::Regex::new`
48-
--> $DIR/conf_disallowed_methods.rs:48:53
48+
--> $DIR/conf_disallowed_methods.rs:49:53
4949
|
5050
LL | let in_method_call = ["^", "$"].into_iter().map(Regex::new);
5151
| ^^^^^^^^^^
5252

5353
error: use of a disallowed method `futures::stream::select_all`
54-
--> $DIR/conf_disallowed_methods.rs:51:31
54+
--> $DIR/conf_disallowed_methods.rs:52:31
5555
|
5656
LL | let same_name_as_module = select_all(vec![empty::<()>()]);
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5858

5959
error: use of a disallowed method `conf_disallowed_methods::local_fn`
60-
--> $DIR/conf_disallowed_methods.rs:53:5
60+
--> $DIR/conf_disallowed_methods.rs:54:5
6161
|
6262
LL | local_fn();
6363
| ^^^^^^^^^^
6464

6565
error: use of a disallowed method `conf_disallowed_methods::local_mod::f`
66-
--> $DIR/conf_disallowed_methods.rs:54:5
66+
--> $DIR/conf_disallowed_methods.rs:55:5
6767
|
6868
LL | local_mod::f();
6969
| ^^^^^^^^^^^^^^
7070

7171
error: use of a disallowed method `conf_disallowed_methods::Struct::method`
72-
--> $DIR/conf_disallowed_methods.rs:56:5
72+
--> $DIR/conf_disallowed_methods.rs:57:5
7373
|
7474
LL | s.method();
7575
| ^^^^^^^^^^
7676

7777
error: use of a disallowed method `conf_disallowed_methods::Trait::provided_method`
78-
--> $DIR/conf_disallowed_methods.rs:57:5
78+
--> $DIR/conf_disallowed_methods.rs:58:5
7979
|
8080
LL | s.provided_method();
8181
| ^^^^^^^^^^^^^^^^^^^
8282

8383
error: use of a disallowed method `conf_disallowed_methods::Trait::implemented_method`
84-
--> $DIR/conf_disallowed_methods.rs:58:5
84+
--> $DIR/conf_disallowed_methods.rs:59:5
8585
|
8686
LL | s.implemented_method();
8787
| ^^^^^^^^^^^^^^^^^^^^^^

tests/ui-toml/unwrap_used/unwrap_used.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
//@compile-flags: --test
22

3-
#![allow(unused_mut, clippy::get_first, clippy::from_iter_instead_of_collect)]
3+
#![allow(
4+
unused_mut,
5+
clippy::get_first,
6+
clippy::from_iter_instead_of_collect,
7+
clippy::useless_vec
8+
)]
49
#![warn(clippy::unwrap_used)]
510
#![deny(clippy::get_unwrap)]
611

0 commit comments

Comments
 (0)