Skip to content

Commit

Permalink
Fix non-lifetime tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Sep 25, 2024
1 parent f2495a1 commit 8775850
Show file tree
Hide file tree
Showing 46 changed files with 354 additions and 329 deletions.
3 changes: 2 additions & 1 deletion tests/ui-toml/suppress_lint_in_const/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
clippy::no_effect,
clippy::unnecessary_operation,
clippy::useless_vec,
clippy::out_of_bounds_indexing
clippy::out_of_bounds_indexing,
clippy::needless_lifetimes
)]

const ARR: [i32; 2] = [1, 2];
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-toml/suppress_lint_in_const/test.stderr
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:26:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:27: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:41:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:42: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:42:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:43: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:43:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:44: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:49:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:50: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:50:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:51:5
|
LL | v[M];
| ^^^^
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/borrow_box.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#![allow(
clippy::uninlined_format_args,
clippy::disallowed_names,
clippy::needless_pass_by_ref_mut
clippy::needless_pass_by_ref_mut,
clippy::needless_lifetimes
)]

use std::fmt::Display;
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/borrow_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#![allow(
clippy::uninlined_format_args,
clippy::disallowed_names,
clippy::needless_pass_by_ref_mut
clippy::needless_pass_by_ref_mut,
clippy::needless_lifetimes
)]

use std::fmt::Display;
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/borrow_box.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> tests/ui/borrow_box.rs:24:14
--> tests/ui/borrow_box.rs:25:14
|
LL | let foo: &Box<bool>;
| ^^^^^^^^^^ help: try: `&bool`
Expand All @@ -11,55 +11,55 @@ LL | #![deny(clippy::borrowed_box)]
| ^^^^^^^^^^^^^^^^^^^^

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

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

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

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

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

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

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

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

error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> tests/ui/borrow_box.rs:112:25
--> tests/ui/borrow_box.rs:113:25
|
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/boxed_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
clippy::needless_pass_by_value,
clippy::unused_unit,
clippy::redundant_clone,
clippy::match_single_binding
clippy::match_single_binding,
clippy::needless_lifetimes
)]
#![warn(clippy::boxed_local)]

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/boxed_local.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:39:13
--> tests/ui/boxed_local.rs:40:13
|
LL | fn warn_arg(x: Box<A>) {
| ^
Expand All @@ -8,19 +8,19 @@ LL | fn warn_arg(x: Box<A>) {
= help: to override `-D warnings` add `#[allow(clippy::boxed_local)]`

error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:122:12
--> tests/ui/boxed_local.rs:123:12
|
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {}
| ^^^^^^^^^^^

error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:187:44
--> tests/ui/boxed_local.rs:188:44
|
LL | fn default_impl_x(self: Box<Self>, x: Box<u32>) -> u32 {
| ^

error: local variable doesn't need to be boxed here
--> tests/ui/boxed_local.rs:195:16
--> tests/ui/boxed_local.rs:196:16
|
LL | fn foo(x: Box<u32>) {}
| ^
Expand Down
7 changes: 6 additions & 1 deletion tests/ui/derive.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#![allow(clippy::non_canonical_clone_impl, clippy::non_canonical_partial_ord_impl, dead_code)]
#![allow(
clippy::non_canonical_clone_impl,
clippy::non_canonical_partial_ord_impl,
clippy::needless_lifetimes,
dead_code
)]
#![warn(clippy::expl_impl_clone_on_copy)]

#[derive(Copy)]
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/derive.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: you are implementing `Clone` explicitly on a `Copy` type
--> tests/ui/derive.rs:7:1
--> tests/ui/derive.rs:12:1
|
LL | / impl Clone for Qux {
LL | |
Expand All @@ -10,7 +10,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> tests/ui/derive.rs:7:1
--> tests/ui/derive.rs:12:1
|
LL | / impl Clone for Qux {
LL | |
Expand All @@ -23,7 +23,7 @@ LL | | }
= help: to override `-D warnings` add `#[allow(clippy::expl_impl_clone_on_copy)]`

error: you are implementing `Clone` explicitly on a `Copy` type
--> tests/ui/derive.rs:32:1
--> tests/ui/derive.rs:37:1
|
LL | / impl<'a> Clone for Lt<'a> {
LL | |
Expand All @@ -34,7 +34,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> tests/ui/derive.rs:32:1
--> tests/ui/derive.rs:37:1
|
LL | / impl<'a> Clone for Lt<'a> {
LL | |
Expand All @@ -45,7 +45,7 @@ LL | | }
| |_^

error: you are implementing `Clone` explicitly on a `Copy` type
--> tests/ui/derive.rs:44:1
--> tests/ui/derive.rs:49:1
|
LL | / impl Clone for BigArray {
LL | |
Expand All @@ -56,7 +56,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> tests/ui/derive.rs:44:1
--> tests/ui/derive.rs:49:1
|
LL | / impl Clone for BigArray {
LL | |
Expand All @@ -67,7 +67,7 @@ LL | | }
| |_^

error: you are implementing `Clone` explicitly on a `Copy` type
--> tests/ui/derive.rs:56:1
--> tests/ui/derive.rs:61:1
|
LL | / impl Clone for FnPtr {
LL | |
Expand All @@ -78,7 +78,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> tests/ui/derive.rs:56:1
--> tests/ui/derive.rs:61:1
|
LL | / impl Clone for FnPtr {
LL | |
Expand All @@ -89,7 +89,7 @@ LL | | }
| |_^

error: you are implementing `Clone` explicitly on a `Copy` type
--> tests/ui/derive.rs:77:1
--> tests/ui/derive.rs:82:1
|
LL | / impl<T: Clone> Clone for Generic2<T> {
LL | |
Expand All @@ -100,7 +100,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> tests/ui/derive.rs:77:1
--> tests/ui/derive.rs:82:1
|
LL | / impl<T: Clone> Clone for Generic2<T> {
LL | |
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/eta.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
clippy::redundant_closure_call,
clippy::uninlined_format_args,
clippy::useless_vec,
clippy::unnecessary_map_on_constructor
clippy::unnecessary_map_on_constructor,
clippy::needless_lifetimes
)]

use std::path::{Path, PathBuf};
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/eta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
clippy::redundant_closure_call,
clippy::uninlined_format_args,
clippy::useless_vec,
clippy::unnecessary_map_on_constructor
clippy::unnecessary_map_on_constructor,
clippy::needless_lifetimes
)]

use std::path::{Path, PathBuf};
Expand Down
Loading

0 comments on commit 8775850

Please sign in to comment.