Remove #[allow(unused_tuple_struct_fields)] from Clippy tests

This commit is contained in:
Jake Goulding 2023-11-29 15:29:11 -05:00
parent de06ce886e
commit 04ebf3c8c9
18 changed files with 59 additions and 70 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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()`
@ -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 {{}}
@ -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()`

View file

@ -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};

View file

@ -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};

View file

@ -1,7 +1,6 @@
#![feature(never_type)]
#![allow(
unused_mut,
unused_tuple_struct_fields,
clippy::redundant_allocation,
clippy::needless_pass_by_ref_mut
)]

View file

@ -1,7 +1,6 @@
#![feature(never_type)]
#![allow(
unused_mut,
unused_tuple_struct_fields,
clippy::redundant_allocation,
clippy::needless_pass_by_ref_mut
)]

View file

@ -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`
@ -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`

View file

@ -1,5 +1,4 @@
#![warn(clippy::init_numbered_fields)]
#![allow(unused_tuple_struct_fields)]
#[derive(Default)]
struct TupleStruct(u32, u32, u8);

View file

@ -1,5 +1,4 @@
#![warn(clippy::init_numbered_fields)]
#![allow(unused_tuple_struct_fields)]
#[derive(Default)]
struct TupleStruct(u32, u32, u8);

View file

@ -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 {
| _____________^
@ -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 {
| _____________^

View file

@ -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,

View file

@ -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,

View file

@ -1,5 +1,5 @@
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:11:5
--> $DIR/option_if_let_else.rs:10:5
|
LL | / if let Some(x) = string {
LL | | (true, x)
@ -12,19 +12,19 @@ LL | | }
= help: to override `-D warnings` add `#[allow(clippy::option_if_let_else)]`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:29:13
--> $DIR/option_if_let_else.rs:28:13
|
LL | let _ = if let Some(s) = *string { s.len() } else { 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:30:13
--> $DIR/option_if_let_else.rs:29:13
|
LL | let _ = if let Some(s) = &num { s } else { &0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:31:13
--> $DIR/option_if_let_else.rs:30:13
|
LL | let _ = if let Some(s) = &mut num {
| _____________^
@ -44,13 +44,13 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:37:13
--> $DIR/option_if_let_else.rs:36:13
|
LL | let _ = if let Some(ref s) = num { s } else { &0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:38:13
--> $DIR/option_if_let_else.rs:37:13
|
LL | let _ = if let Some(mut s) = num {
| _____________^
@ -70,7 +70,7 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:44:13
--> $DIR/option_if_let_else.rs:43:13
|
LL | let _ = if let Some(ref mut s) = num {
| _____________^
@ -90,7 +90,7 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:53:5
--> $DIR/option_if_let_else.rs:52:5
|
LL | / if let Some(x) = arg {
LL | | let y = x * x;
@ -109,7 +109,7 @@ LL + })
|
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:66:13
--> $DIR/option_if_let_else.rs:65:13
|
LL | let _ = if let Some(x) = arg {
| _____________^
@ -121,7 +121,7 @@ LL | | };
| |_____^ help: try: `arg.map_or_else(side_effect, |x| x)`
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:75:13
--> $DIR/option_if_let_else.rs:74:13
|
LL | let _ = if let Some(x) = arg {
| _____________^
@ -144,7 +144,7 @@ LL ~ }, |x| x * x * x * x);
|
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:108:13
--> $DIR/option_if_let_else.rs:107:13
|
LL | / if let Some(idx) = s.find('.') {
LL | | vec![s[..idx].to_string(), s[idx..].to_string()]
@ -154,7 +154,7 @@ LL | | }
| |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])`
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:119:5
--> $DIR/option_if_let_else.rs:118:5
|
LL | / if let Ok(binding) = variable {
LL | | println!("Ok {binding}");
@ -177,13 +177,13 @@ LL + })
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:143:13
--> $DIR/option_if_let_else.rs:142:13
|
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:153:13
--> $DIR/option_if_let_else.rs:152:13
|
LL | let _ = if let Some(x) = Some(0) {
| _____________^
@ -205,13 +205,13 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:181:13
--> $DIR/option_if_let_else.rs:180:13
|
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:185:13
--> $DIR/option_if_let_else.rs:184:13
|
LL | let _ = if let Some(x) = Some(0) {
| _____________^
@ -231,7 +231,7 @@ LL ~ });
|
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:224:13
--> $DIR/option_if_let_else.rs:223:13
|
LL | let _ = match s {
| _____________^
@ -241,7 +241,7 @@ LL | | };
| |_____^ help: try: `s.map_or(1, |string| string.len())`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:228:13
--> $DIR/option_if_let_else.rs:227:13
|
LL | let _ = match Some(10) {
| _____________^
@ -251,7 +251,7 @@ LL | | };
| |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:234:13
--> $DIR/option_if_let_else.rs:233:13
|
LL | let _ = match res {
| _____________^
@ -261,7 +261,7 @@ LL | | };
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:238:13
--> $DIR/option_if_let_else.rs:237:13
|
LL | let _ = match res {
| _____________^
@ -271,13 +271,13 @@ LL | | };
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:242:13
--> $DIR/option_if_let_else.rs:241:13
|
LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:259:17
--> $DIR/option_if_let_else.rs:258:17
|
LL | let _ = match initial {
| _________________^
@ -287,7 +287,7 @@ LL | | };
| |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:266:17
--> $DIR/option_if_let_else.rs:265:17
|
LL | let _ = match initial {
| _________________^
@ -297,7 +297,7 @@ LL | | };
| |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))`
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:289:24
--> $DIR/option_if_let_else.rs:288:24
|
LL | let mut _hashmap = if let Some(hm) = &opt {
| ________________________^
@ -308,7 +308,7 @@ LL | | };
| |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())`
error: use Option::map_or_else instead of an if let/else
--> $DIR/option_if_let_else.rs:295:19
--> $DIR/option_if_let_else.rs:294:19
|
LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())`

View file

@ -1,5 +1,4 @@
#![warn(clippy::unreadable_literal)]
#![allow(unused_tuple_struct_fields)]
struct Foo(u64);

View file

@ -1,5 +1,4 @@
#![warn(clippy::unreadable_literal)]
#![allow(unused_tuple_struct_fields)]
struct Foo(u64);

View file

@ -1,5 +1,5 @@
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:32:17
--> $DIR/unreadable_literal.rs:31:17
|
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^^^ help: consider: `0b11_0110_i64`
@ -8,55 +8,55 @@ LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
= help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:32:31
--> $DIR/unreadable_literal.rs:31:31
|
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^^^^^^^ help: consider: `0x1234_5678_usize`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:32:49
--> $DIR/unreadable_literal.rs:31:49
|
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^ help: consider: `123_456_f32`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:32:61
--> $DIR/unreadable_literal.rs:31:61
|
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^^^ help: consider: `1.234_567_f32`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:34:20
--> $DIR/unreadable_literal.rs:33:20
|
LL | let _bad_sci = 1.123456e1;
| ^^^^^^^^^^ help: consider: `1.123_456e1`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:36:18
--> $DIR/unreadable_literal.rs:35:18
|
LL | let _fail1 = 0xabcdef;
| ^^^^^^^^ help: consider: `0x00ab_cdef`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:37:23
--> $DIR/unreadable_literal.rs:36:23
|
LL | let _fail2: u32 = 0xBAFEBAFE;
| ^^^^^^^^^^ help: consider: `0xBAFE_BAFE`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:38:18
--> $DIR/unreadable_literal.rs:37:18
|
LL | let _fail3 = 0xabcdeff;
| ^^^^^^^^^ help: consider: `0x0abc_deff`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:39:24
--> $DIR/unreadable_literal.rs:38:24
|
LL | let _fail4: i128 = 0xabcabcabcabcabcabc;
| ^^^^^^^^^^^^^^^^^^^^ help: consider: `0x00ab_cabc_abca_bcab_cabc`
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:40:18
--> $DIR/unreadable_literal.rs:39:18
|
LL | let _fail5 = 1.100300400;
| ^^^^^^^^^^^ help: consider: `1.100_300_400`