Skip to content

Commit

Permalink
Remove #[allow(unused_tuple_struct_fields)] from Clippy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shepmaster committed Jan 2, 2024
1 parent de06ce8 commit 04ebf3c
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 70 deletions.
1 change: 0 additions & 1 deletion tests/ui/borrow_interior_mutable_const/auxiliary/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 2,6 @@
// As the most common case is the `http` crate, it replicates `http::HeaderName`'s structure.

#![allow(clippy::declare_interior_mutable_const)]
#![allow(unused_tuple_struct_fields)]

use std::sync::atomic::AtomicUsize;

Expand Down
1 change: 0 additions & 1 deletion tests/ui/format.fixed
Original file line number Diff line number Diff line change
@@ -1,6 1,5 @@
#![warn(clippy::useless_format)]
#![allow(
unused_tuple_struct_fields,
clippy::print_literal,
clippy::redundant_clone,
clippy::to_string_in_format_args,
Expand Down
1 change: 0 additions & 1 deletion tests/ui/format.rs
Original file line number Diff line number Diff line change
@@ -1,6 1,5 @@
#![warn(clippy::useless_format)]
#![allow(
unused_tuple_struct_fields,
clippy::print_literal,
clippy::redundant_clone,
clippy::to_string_in_format_args,
Expand Down
30 changes: 15 additions & 15 deletions tests/ui/format.stderr
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
error: useless use of `format!`
--> $DIR/format.rs:20:5
--> $DIR/format.rs:19:5
|
LL | format!("foo");
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`
Expand All @@ -8,19 8,19 @@ LL | format!("foo");
= help: to override `-D warnings` add `#[allow(clippy::useless_format)]`

error: useless use of `format!`
--> $DIR/format.rs:21:5
--> $DIR/format.rs:20:5
|
LL | format!("{{}}");
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{}".to_string()`

error: useless use of `format!`
--> $DIR/format.rs:22:5
--> $DIR/format.rs:21:5
|
LL | format!("{{}} abc {{}}");
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{} abc {}".to_string()`

error: useless use of `format!`
--> $DIR/format.rs:23:5
--> $DIR/format.rs:22:5
|
LL | / format!(
LL | | r##"foo {{}}
Expand All @@ -35,67 35,67 @@ LL ~ " bar"##.to_string();
|

error: useless use of `format!`
--> $DIR/format.rs:28:13
--> $DIR/format.rs:27:13
|
LL | let _ = format!("");
| ^^^^^^^^^^^ help: consider using `String::new()`: `String::new()`

error: useless use of `format!`
--> $DIR/format.rs:30:5
--> $DIR/format.rs:29:5
|
LL | format!("{}", "foo");
| ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`

error: useless use of `format!`
--> $DIR/format.rs:38:5
--> $DIR/format.rs:37:5
|
LL | format!("{}", arg);
| ^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string()`

error: useless use of `format!`
--> $DIR/format.rs:68:5
--> $DIR/format.rs:67:5
|
LL | format!("{}", 42.to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `42.to_string()`

error: useless use of `format!`
--> $DIR/format.rs:70:5
--> $DIR/format.rs:69:5
|
LL | format!("{}", x.display().to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.display().to_string()`

error: useless use of `format!`
--> $DIR/format.rs:74:18
--> $DIR/format.rs:73:18
|
LL | let _ = Some(format!("{}", a "bar"));
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `a "bar"`

error: useless use of `format!`
--> $DIR/format.rs:78:22
--> $DIR/format.rs:77:22
|
LL | let _s: String = format!("{}", &*v.join("\n"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `(&*v.join("\n")).to_string()`

error: useless use of `format!`
--> $DIR/format.rs:84:13
--> $DIR/format.rs:83:13
|
LL | let _ = format!("{x}");
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`

error: useless use of `format!`
--> $DIR/format.rs:86:13
--> $DIR/format.rs:85:13
|
LL | let _ = format!("{y}", y = x);
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`

error: useless use of `format!`
--> $DIR/format.rs:90:13
--> $DIR/format.rs:89:13
|
LL | let _ = format!("{abc}");
| ^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `abc.to_string()`

error: useless use of `format!`
--> $DIR/format.rs:92:13
--> $DIR/format.rs:91:13
|
LL | let _ = format!("{xx}");
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `xx.to_string()`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/from_iter_instead_of_collect.fixed
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
#![warn(clippy::from_iter_instead_of_collect)]
#![allow(unused_imports, unused_tuple_struct_fields)]
#![allow(unused_imports)]
#![allow(clippy::useless_vec)]

use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/from_iter_instead_of_collect.rs
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
#![warn(clippy::from_iter_instead_of_collect)]
#![allow(unused_imports, unused_tuple_struct_fields)]
#![allow(unused_imports)]
#![allow(clippy::useless_vec)]

use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};
Expand Down
1 change: 0 additions & 1 deletion tests/ui/must_use_candidates.fixed
Original file line number Diff line number Diff line change
@@ -1,7 1,6 @@
#![feature(never_type)]
#![allow(
unused_mut,
unused_tuple_struct_fields,
clippy::redundant_allocation,
clippy::needless_pass_by_ref_mut
)]
Expand Down
1 change: 0 additions & 1 deletion tests/ui/must_use_candidates.rs
Original file line number Diff line number Diff line change
@@ -1,7 1,6 @@
#![feature(never_type)]
#![allow(
unused_mut,
unused_tuple_struct_fields,
clippy::redundant_allocation,
clippy::needless_pass_by_ref_mut
)]
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/must_use_candidates.stderr
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
error: this function could have a `#[must_use]` attribute
--> $DIR/must_use_candidates.rs:16:1
--> $DIR/must_use_candidates.rs:15:1
|
LL | pub fn pure(i: u8) -> u8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pure(i: u8) -> u8`
Expand All @@ -8,25 8,25 @@ LL | pub fn pure(i: u8) -> u8 {
= help: to override `-D warnings` add `#[allow(clippy::must_use_candidate)]`

error: this method could have a `#[must_use]` attribute
--> $DIR/must_use_candidates.rs:21:5
--> $DIR/must_use_candidates.rs:20:5
|
LL | pub fn inherent_pure(&self) -> u8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn inherent_pure(&self) -> u8`

error: this function could have a `#[must_use]` attribute
--> $DIR/must_use_candidates.rs:52:1
--> $DIR/must_use_candidates.rs:51:1
|
LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool`

error: this function could have a `#[must_use]` attribute
--> $DIR/must_use_candidates.rs:64:1
--> $DIR/must_use_candidates.rs:63:1
|
LL | pub fn rcd(_x: Rc<u32>) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn rcd(_x: Rc<u32>) -> bool`

error: this function could have a `#[must_use]` attribute
--> $DIR/must_use_candidates.rs:72:1
--> $DIR/must_use_candidates.rs:71:1
|
LL | pub fn arcd(_x: Arc<u32>) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn arcd(_x: Arc<u32>) -> bool`
Expand Down
1 change: 0 additions & 1 deletion tests/ui/numbered_fields.fixed
Original file line number Diff line number Diff line change
@@ -1,5 1,4 @@
#![warn(clippy::init_numbered_fields)]
#![allow(unused_tuple_struct_fields)]

#[derive(Default)]
struct TupleStruct(u32, u32, u8);
Expand Down
1 change: 0 additions & 1 deletion tests/ui/numbered_fields.rs
Original file line number Diff line number Diff line change
@@ -1,5 1,4 @@
#![warn(clippy::init_numbered_fields)]
#![allow(unused_tuple_struct_fields)]

#[derive(Default)]
struct TupleStruct(u32, u32, u8);
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/numbered_fields.stderr
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
error: used a field initializer for a tuple struct
--> $DIR/numbered_fields.rs:18:13
--> $DIR/numbered_fields.rs:17:13
|
LL | let _ = TupleStruct {
| _____________^
Expand All @@ -13,7 13,7 @@ LL | | };
= help: to override `-D warnings` add `#[allow(clippy::init_numbered_fields)]`

error: used a field initializer for a tuple struct
--> $DIR/numbered_fields.rs:25:13
--> $DIR/numbered_fields.rs:24:13
|
LL | let _ = TupleStruct {
| _____________^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/option_if_let_else.fixed
Original file line number Diff line number Diff line change
@@ -1,6 1,5 @@
#![warn(clippy::option_if_let_else)]
#![allow(
unused_tuple_struct_fields,
clippy::ref_option_ref,
clippy::equatable_if_let,
clippy::let_unit_value,
Expand Down
1 change: 0 additions & 1 deletion tests/ui/option_if_let_else.rs
Original file line number Diff line number Diff line change
@@ -1,6 1,5 @@
#![warn(clippy::option_if_let_else)]
#![allow(
unused_tuple_struct_fields,
clippy::ref_option_ref,
clippy::equatable_if_let,
clippy::let_unit_value,
Expand Down
Loading

0 comments on commit 04ebf3c

Please sign in to comment.