Skip to content

Commit c530d32

Browse files
committed
Allow collection_is_never_read in tests of unrelated lints
1 parent fc6e9d6 commit c530d32

File tree

95 files changed

+604
-517
lines changed

Some content is hidden

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

95 files changed

+604
-517
lines changed

tests/ui-toml/too_large_for_stack/useless_vec.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::useless_vec)]
2+
#![allow(clippy::collection_is_never_read)]
23

34
fn main() {
45
let x = [0u8; 500];

tests/ui-toml/too_large_for_stack/useless_vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::useless_vec)]
2+
#![allow(clippy::collection_is_never_read)]
23

34
fn main() {
45
let x = vec![0u8; 500];

tests/ui-toml/too_large_for_stack/useless_vec.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: useless use of `vec!`
2-
--> $DIR/useless_vec.rs:4:13
2+
--> $DIR/useless_vec.rs:5:13
33
|
44
LL | let x = vec![0u8; 500];
55
| ^^^^^^^^^^^^^^ help: you can use an array directly: `[0u8; 500]`

tests/ui/boxed_local.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
clippy::needless_pass_by_value,
55
clippy::unused_unit,
66
clippy::redundant_clone,
7-
clippy::match_single_binding
7+
clippy::match_single_binding,
8+
clippy::collection_is_never_read
89
)]
910
#![warn(clippy::boxed_local)]
1011

tests/ui/boxed_local.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: local variable doesn't need to be boxed here
2-
--> $DIR/boxed_local.rs:40:13
2+
--> $DIR/boxed_local.rs:41:13
33
|
44
LL | fn warn_arg(x: Box<A>) {
55
| ^
@@ -8,19 +8,19 @@ LL | fn warn_arg(x: Box<A>) {
88
= help: to override `-D warnings` add `#[allow(clippy::boxed_local)]`
99

1010
error: local variable doesn't need to be boxed here
11-
--> $DIR/boxed_local.rs:123:12
11+
--> $DIR/boxed_local.rs:124:12
1212
|
1313
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
1414
| ^^^^^^^^^^^
1515

1616
error: local variable doesn't need to be boxed here
17-
--> $DIR/boxed_local.rs:188:44
17+
--> $DIR/boxed_local.rs:189:44
1818
|
1919
LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
2020
| ^
2121

2222
error: local variable doesn't need to be boxed here
23-
--> $DIR/boxed_local.rs:196:16
23+
--> $DIR/boxed_local.rs:197:16
2424
|
2525
LL | fn foo(x: Box<u32>) {}
2626
| ^

tests/ui/branches_sharing_code/shared_at_top.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
22
#![allow(dead_code)]
3-
#![allow(clippy::mixed_read_write_in_expression, clippy::uninlined_format_args)]
3+
#![allow(
4+
clippy::mixed_read_write_in_expression,
5+
clippy::uninlined_format_args,
6+
clippy::collection_is_never_read
7+
)]
48
//@no-rustfix
59
// This tests the branches_sharing_code lint at the start of blocks
610

tests/ui/branches_sharing_code/shared_at_top.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: all if blocks contain the same code at the start
2-
--> $DIR/shared_at_top.rs:11:5
2+
--> $DIR/shared_at_top.rs:15:5
33
|
44
LL | / if true {
55
LL | |
@@ -18,7 +18,7 @@ LL + if true {
1818
|
1919

2020
error: all if blocks contain the same code at the start
21-
--> $DIR/shared_at_top.rs:21:5
21+
--> $DIR/shared_at_top.rs:25:5
2222
|
2323
LL | / if x == 0 {
2424
LL | |
@@ -37,7 +37,7 @@ LL + if x == 0 {
3737
|
3838

3939
error: all if blocks contain the same code at the start
40-
--> $DIR/shared_at_top.rs:43:5
40+
--> $DIR/shared_at_top.rs:47:5
4141
|
4242
LL | / let _ = if x == 7 {
4343
LL | |
@@ -51,7 +51,7 @@ LL + let _ = if x == 7 {
5151
|
5252

5353
error: all if blocks contain the same code at the start
54-
--> $DIR/shared_at_top.rs:62:5
54+
--> $DIR/shared_at_top.rs:66:5
5555
|
5656
LL | / if x == 10 {
5757
LL | |
@@ -68,7 +68,7 @@ LL + if x == 10 {
6868
|
6969

7070
error: all if blocks contain the same code at the start
71-
--> $DIR/shared_at_top.rs:77:5
71+
--> $DIR/shared_at_top.rs:81:5
7272
|
7373
LL | / if x == 11 {
7474
LL | |
@@ -85,7 +85,7 @@ LL + if x == 11 {
8585
|
8686

8787
error: all if blocks contain the same code at the start
88-
--> $DIR/shared_at_top.rs:94:5
88+
--> $DIR/shared_at_top.rs:98:5
8989
|
9090
LL | / if x == 2020 {
9191
LL | |
@@ -101,7 +101,7 @@ LL + if x == 2020 {
101101
|
102102

103103
error: this `if` has identical blocks
104-
--> $DIR/shared_at_top.rs:103:18
104+
--> $DIR/shared_at_top.rs:107:18
105105
|
106106
LL | if x == 2019 {
107107
| __________________^
@@ -111,7 +111,7 @@ LL | | } else {
111111
| |_____^
112112
|
113113
note: same as this
114-
--> $DIR/shared_at_top.rs:106:12
114+
--> $DIR/shared_at_top.rs:110:12
115115
|
116116
LL | } else {
117117
| ____________^

tests/ui/clear_with_drain.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(unused)]
1+
#![allow(unused, clippy::collection_is_never_read)]
22
#![warn(clippy::clear_with_drain)]
33

44
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};

tests/ui/clear_with_drain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(unused)]
1+
#![allow(unused, clippy::collection_is_never_read)]
22
#![warn(clippy::clear_with_drain)]
33

44
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};

tests/ui/clone_on_copy.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
clippy::unnecessary_operation,
77
clippy::vec_init_then_push,
88
clippy::toplevel_ref_arg,
9-
clippy::needless_borrow
9+
clippy::needless_borrow,
10+
clippy::collection_is_never_read
1011
)]
1112

1213
use std::cell::RefCell;

tests/ui/clone_on_copy.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
clippy::unnecessary_operation,
77
clippy::vec_init_then_push,
88
clippy::toplevel_ref_arg,
9-
clippy::needless_borrow
9+
clippy::needless_borrow,
10+
clippy::collection_is_never_read
1011
)]
1112

1213
use std::cell::RefCell;

tests/ui/clone_on_copy.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: using `clone` on type `i32` which implements the `Copy` trait
2-
--> $DIR/clone_on_copy.rs:23:5
2+
--> $DIR/clone_on_copy.rs:24:5
33
|
44
LL | 42.clone();
55
| ^^^^^^^^^^ help: try removing the `clone` call: `42`
@@ -8,49 +8,49 @@ LL | 42.clone();
88
= help: to override `-D warnings` add `#[allow(clippy::clone_on_copy)]`
99

1010
error: using `clone` on type `i32` which implements the `Copy` trait
11-
--> $DIR/clone_on_copy.rs:27:5
11+
--> $DIR/clone_on_copy.rs:28:5
1212
|
1313
LL | (&42).clone();
1414
| ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
1515

1616
error: using `clone` on type `i32` which implements the `Copy` trait
17-
--> $DIR/clone_on_copy.rs:30:5
17+
--> $DIR/clone_on_copy.rs:31:5
1818
|
1919
LL | rc.borrow().clone();
2020
| ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()`
2121

2222
error: using `clone` on type `u32` which implements the `Copy` trait
23-
--> $DIR/clone_on_copy.rs:33:5
23+
--> $DIR/clone_on_copy.rs:34:5
2424
|
2525
LL | x.clone().rotate_left(1);
2626
| ^^^^^^^^^ help: try removing the `clone` call: `x`
2727

2828
error: using `clone` on type `i32` which implements the `Copy` trait
29-
--> $DIR/clone_on_copy.rs:47:5
29+
--> $DIR/clone_on_copy.rs:48:5
3030
|
3131
LL | m!(42).clone();
3232
| ^^^^^^^^^^^^^^ help: try removing the `clone` call: `m!(42)`
3333

3434
error: using `clone` on type `[u32; 2]` which implements the `Copy` trait
35-
--> $DIR/clone_on_copy.rs:57:5
35+
--> $DIR/clone_on_copy.rs:58:5
3636
|
3737
LL | x.clone()[0];
3838
| ^^^^^^^^^ help: try dereferencing it: `(*x)`
3939

4040
error: using `clone` on type `char` which implements the `Copy` trait
41-
--> $DIR/clone_on_copy.rs:67:14
41+
--> $DIR/clone_on_copy.rs:68:14
4242
|
4343
LL | is_ascii('z'.clone());
4444
| ^^^^^^^^^^^ help: try removing the `clone` call: `'z'`
4545

4646
error: using `clone` on type `i32` which implements the `Copy` trait
47-
--> $DIR/clone_on_copy.rs:71:14
47+
--> $DIR/clone_on_copy.rs:72:14
4848
|
4949
LL | vec.push(42.clone());
5050
| ^^^^^^^^^^ help: try removing the `clone` call: `42`
5151

5252
error: using `clone` on type `Option<i32>` which implements the `Copy` trait
53-
--> $DIR/clone_on_copy.rs:75:17
53+
--> $DIR/clone_on_copy.rs:76:17
5454
|
5555
LL | let value = opt.clone()?; // operator precedence needed (*opt)?
5656
| ^^^^^^^^^^^ help: try dereferencing it: `(*opt)`

tests/ui/crashes/ice-2774.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct Bar {
1010
#[derive(Eq, PartialEq, Debug, Hash)]
1111
pub struct Foo;
1212

13-
#[allow(clippy::implicit_hasher)]
13+
#[allow(clippy::implicit_hasher, clippy::collection_is_never_read)]
1414
// This should not cause a "cannot relate bound region" ICE.
1515
pub fn add_barfoos_to_foos(bars: &HashSet<&Bar>) {
1616
//~^ ERROR: the following explicit lifetimes could be elided: 'a
@@ -19,7 +19,7 @@ pub fn add_barfoos_to_foos(bars: &HashSet<&Bar>) {
1919
foos.extend(bars.iter().map(|b| &b.foo));
2020
}
2121

22-
#[allow(clippy::implicit_hasher)]
22+
#[allow(clippy::implicit_hasher, clippy::collection_is_never_read)]
2323
// Also, this should not cause a "cannot relate bound region" ICE.
2424
pub fn add_barfoos_to_foos2(bars: &HashSet<&Bar>) {
2525
let mut foos = HashSet::new();

tests/ui/crashes/ice-2774.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct Bar {
1010
#[derive(Eq, PartialEq, Debug, Hash)]
1111
pub struct Foo;
1212

13-
#[allow(clippy::implicit_hasher)]
13+
#[allow(clippy::implicit_hasher, clippy::collection_is_never_read)]
1414
// This should not cause a "cannot relate bound region" ICE.
1515
pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
1616
//~^ ERROR: the following explicit lifetimes could be elided: 'a
@@ -19,7 +19,7 @@ pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
1919
foos.extend(bars.iter().map(|b| &b.foo));
2020
}
2121

22-
#[allow(clippy::implicit_hasher)]
22+
#[allow(clippy::implicit_hasher, clippy::collection_is_never_read)]
2323
// Also, this should not cause a "cannot relate bound region" ICE.
2424
pub fn add_barfoos_to_foos2(bars: &HashSet<&Bar>) {
2525
let mut foos = HashSet::new();

tests/ui/eta.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
clippy::redundant_closure_call,
99
clippy::uninlined_format_args,
1010
clippy::useless_vec,
11-
clippy::unnecessary_map_on_constructor
11+
clippy::unnecessary_map_on_constructor,
12+
clippy::collection_is_never_read
1213
)]
1314

1415
use std::path::{Path, PathBuf};

tests/ui/eta.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
clippy::redundant_closure_call,
99
clippy::uninlined_format_args,
1010
clippy::useless_vec,
11-
clippy::unnecessary_map_on_constructor
11+
clippy::unnecessary_map_on_constructor,
12+
clippy::collection_is_never_read
1213
)]
1314

1415
use std::path::{Path, PathBuf};

0 commit comments

Comments
 (0)