Skip to content

Commit 8775850

Browse files
committed
Fix non-lifetime tests
1 parent f2495a1 commit 8775850

Some content is hidden

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

46 files changed

+354
-329
lines changed

tests/ui-toml/suppress_lint_in_const/test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
clippy::no_effect,
88
clippy::unnecessary_operation,
99
clippy::useless_vec,
10-
clippy::out_of_bounds_indexing
10+
clippy::out_of_bounds_indexing,
11+
clippy::needless_lifetimes
1112
)]
1213

1314
const ARR: [i32; 2] = [1, 2];

tests/ui-toml/suppress_lint_in_const/test.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: indexing may panic
2-
--> tests/ui-toml/suppress_lint_in_const/test.rs:26:5
2+
--> tests/ui-toml/suppress_lint_in_const/test.rs:27:5
33
|
44
LL | x[index];
55
| ^^^^^^^^
@@ -9,39 +9,39 @@ LL | x[index];
99
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
1010

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

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

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

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

4343
error: indexing may panic
44-
--> tests/ui-toml/suppress_lint_in_const/test.rs:50:5
44+
--> tests/ui-toml/suppress_lint_in_const/test.rs:51:5
4545
|
4646
LL | v[M];
4747
| ^^^^

tests/ui/borrow_box.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#![allow(
44
clippy::uninlined_format_args,
55
clippy::disallowed_names,
6-
clippy::needless_pass_by_ref_mut
6+
clippy::needless_pass_by_ref_mut,
7+
clippy::needless_lifetimes
78
)]
89

910
use std::fmt::Display;

tests/ui/borrow_box.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#![allow(
44
clippy::uninlined_format_args,
55
clippy::disallowed_names,
6-
clippy::needless_pass_by_ref_mut
6+
clippy::needless_pass_by_ref_mut,
7+
clippy::needless_lifetimes
78
)]
89

910
use std::fmt::Display;

tests/ui/borrow_box.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2-
--> tests/ui/borrow_box.rs:24:14
2+
--> tests/ui/borrow_box.rs:25:14
33
|
44
LL | let foo: &Box<bool>;
55
| ^^^^^^^^^^ help: try: `&bool`
@@ -11,55 +11,55 @@ LL | #![deny(clippy::borrowed_box)]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
14-
--> tests/ui/borrow_box.rs:29:10
14+
--> tests/ui/borrow_box.rs:30:10
1515
|
1616
LL | foo: &'a Box<bool>,
1717
| ^^^^^^^^^^^^^ help: try: `&'a bool`
1818

1919
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
20-
--> tests/ui/borrow_box.rs:34:17
20+
--> tests/ui/borrow_box.rs:35:17
2121
|
2222
LL | fn test4(a: &Box<bool>);
2323
| ^^^^^^^^^^ help: try: `&bool`
2424

2525
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
26-
--> tests/ui/borrow_box.rs:95:25
26+
--> tests/ui/borrow_box.rs:96:25
2727
|
2828
LL | pub fn test14(_display: &Box<dyn Display>) {}
2929
| ^^^^^^^^^^^^^^^^^ help: try: `&dyn Display`
3030

3131
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
32-
--> tests/ui/borrow_box.rs:97:25
32+
--> tests/ui/borrow_box.rs:98:25
3333
|
3434
LL | pub fn test15(_display: &Box<dyn Display + Send>) {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
3636

3737
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
38-
--> tests/ui/borrow_box.rs:99:29
38+
--> tests/ui/borrow_box.rs:100:29
3939
|
4040
LL | pub fn test16<'a>(_display: &'a Box<dyn Display + 'a>) {}
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (dyn Display + 'a)`
4242

4343
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
44-
--> tests/ui/borrow_box.rs:102:25
44+
--> tests/ui/borrow_box.rs:103:25
4545
|
4646
LL | pub fn test17(_display: &Box<impl Display>) {}
4747
| ^^^^^^^^^^^^^^^^^^ help: try: `&impl Display`
4848

4949
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
50-
--> tests/ui/borrow_box.rs:104:25
50+
--> tests/ui/borrow_box.rs:105:25
5151
|
5252
LL | pub fn test18(_display: &Box<impl Display + Send>) {}
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(impl Display + Send)`
5454

5555
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
56-
--> tests/ui/borrow_box.rs:106:29
56+
--> tests/ui/borrow_box.rs:107:29
5757
|
5858
LL | pub fn test19<'a>(_display: &'a Box<impl Display + 'a>) {}
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (impl Display + 'a)`
6060

6161
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
62-
--> tests/ui/borrow_box.rs:112:25
62+
--> tests/ui/borrow_box.rs:113:25
6363
|
6464
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`

tests/ui/boxed_local.rs

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

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-
--> tests/ui/boxed_local.rs:39:13
2+
--> tests/ui/boxed_local.rs:40: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-
--> tests/ui/boxed_local.rs:122:12
11+
--> tests/ui/boxed_local.rs:123: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-
--> tests/ui/boxed_local.rs:187:44
17+
--> tests/ui/boxed_local.rs:188: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-
--> tests/ui/boxed_local.rs:195:16
23+
--> tests/ui/boxed_local.rs:196:16
2424
|
2525
LL | fn foo(x: Box<u32>) {}
2626
| ^

tests/ui/derive.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
#![allow(clippy::non_canonical_clone_impl, clippy::non_canonical_partial_ord_impl, dead_code)]
1+
#![allow(
2+
clippy::non_canonical_clone_impl,
3+
clippy::non_canonical_partial_ord_impl,
4+
clippy::needless_lifetimes,
5+
dead_code
6+
)]
27
#![warn(clippy::expl_impl_clone_on_copy)]
38

49
#[derive(Copy)]

tests/ui/derive.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: you are implementing `Clone` explicitly on a `Copy` type
2-
--> tests/ui/derive.rs:7:1
2+
--> tests/ui/derive.rs:12:1
33
|
44
LL | / impl Clone for Qux {
55
LL | |
@@ -10,7 +10,7 @@ LL | | }
1010
| |_^
1111
|
1212
note: consider deriving `Clone` or removing `Copy`
13-
--> tests/ui/derive.rs:7:1
13+
--> tests/ui/derive.rs:12:1
1414
|
1515
LL | / impl Clone for Qux {
1616
LL | |
@@ -23,7 +23,7 @@ LL | | }
2323
= help: to override `-D warnings` add `#[allow(clippy::expl_impl_clone_on_copy)]`
2424

2525
error: you are implementing `Clone` explicitly on a `Copy` type
26-
--> tests/ui/derive.rs:32:1
26+
--> tests/ui/derive.rs:37:1
2727
|
2828
LL | / impl<'a> Clone for Lt<'a> {
2929
LL | |
@@ -34,7 +34,7 @@ LL | | }
3434
| |_^
3535
|
3636
note: consider deriving `Clone` or removing `Copy`
37-
--> tests/ui/derive.rs:32:1
37+
--> tests/ui/derive.rs:37:1
3838
|
3939
LL | / impl<'a> Clone for Lt<'a> {
4040
LL | |
@@ -45,7 +45,7 @@ LL | | }
4545
| |_^
4646

4747
error: you are implementing `Clone` explicitly on a `Copy` type
48-
--> tests/ui/derive.rs:44:1
48+
--> tests/ui/derive.rs:49:1
4949
|
5050
LL | / impl Clone for BigArray {
5151
LL | |
@@ -56,7 +56,7 @@ LL | | }
5656
| |_^
5757
|
5858
note: consider deriving `Clone` or removing `Copy`
59-
--> tests/ui/derive.rs:44:1
59+
--> tests/ui/derive.rs:49:1
6060
|
6161
LL | / impl Clone for BigArray {
6262
LL | |
@@ -67,7 +67,7 @@ LL | | }
6767
| |_^
6868

6969
error: you are implementing `Clone` explicitly on a `Copy` type
70-
--> tests/ui/derive.rs:56:1
70+
--> tests/ui/derive.rs:61:1
7171
|
7272
LL | / impl Clone for FnPtr {
7373
LL | |
@@ -78,7 +78,7 @@ LL | | }
7878
| |_^
7979
|
8080
note: consider deriving `Clone` or removing `Copy`
81-
--> tests/ui/derive.rs:56:1
81+
--> tests/ui/derive.rs:61:1
8282
|
8383
LL | / impl Clone for FnPtr {
8484
LL | |
@@ -89,7 +89,7 @@ LL | | }
8989
| |_^
9090

9191
error: you are implementing `Clone` explicitly on a `Copy` type
92-
--> tests/ui/derive.rs:77:1
92+
--> tests/ui/derive.rs:82:1
9393
|
9494
LL | / impl<T: Clone> Clone for Generic2<T> {
9595
LL | |
@@ -100,7 +100,7 @@ LL | | }
100100
| |_^
101101
|
102102
note: consider deriving `Clone` or removing `Copy`
103-
--> tests/ui/derive.rs:77:1
103+
--> tests/ui/derive.rs:82:1
104104
|
105105
LL | / impl<T: Clone> Clone for Generic2<T> {
106106
LL | |

tests/ui/eta.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
clippy::redundant_closure_call,
1010
clippy::uninlined_format_args,
1111
clippy::useless_vec,
12-
clippy::unnecessary_map_on_constructor
12+
clippy::unnecessary_map_on_constructor,
13+
clippy::needless_lifetimes
1314
)]
1415

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

tests/ui/eta.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
clippy::redundant_closure_call,
1010
clippy::uninlined_format_args,
1111
clippy::useless_vec,
12-
clippy::unnecessary_map_on_constructor
12+
clippy::unnecessary_map_on_constructor,
13+
clippy::needless_lifetimes
1314
)]
1415

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

0 commit comments

Comments
 (0)