From f3892d0ec1b34b5abba3600b502bde8845cd5552 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Tue, 20 Feb 2024 23:06:42 +0100 Subject: [PATCH] Cleanup more lints --- serde_with/src/de/impls.rs | 8 -------- serde_with/src/serde_conv.rs | 1 - serde_with/src/utils.rs | 3 --- serde_with/tests/base64.rs | 5 ----- serde_with/tests/chrono_0_4.rs | 8 -------- serde_with/tests/derives/lib.rs | 8 -------- serde_with/tests/hashbrown_0_14.rs | 8 -------- serde_with/tests/hex.rs | 8 -------- serde_with/tests/indexmap_1.rs | 8 -------- serde_with/tests/indexmap_2.rs | 8 -------- serde_with/tests/json.rs | 8 -------- serde_with/tests/rust.rs | 8 -------- serde_with/tests/serde_as/lib.rs | 8 -------- serde_with/tests/time_0_3.rs | 8 -------- serde_with/tests/version_numbers.rs | 4 ---- serde_with/tests/with_prefix.rs | 8 -------- serde_with_macros/tests/version_numbers.rs | 4 ---- serde_with_test/tests/derive_display_fromstr.rs | 2 +- serde_with_test/tests/flattened_maybe.rs | 2 +- serde_with_test/tests/serde_as_cfg.rs | 2 +- serde_with_test/tests/serde_conv.rs | 2 +- serde_with_test/tests/with_prefix.rs | 2 +- 22 files changed, 5 insertions(+), 118 deletions(-) diff --git a/serde_with/src/de/impls.rs b/serde_with/src/de/impls.rs index 00647fdc..08eb0994 100644 --- a/serde_with/src/de/impls.rs +++ b/serde_with/src/de/impls.rs @@ -378,10 +378,6 @@ macro_rules! seq_impl { $with_capacity:expr, $append:ident ) => { - // Fix for clippy regression in macros on stable - // The bug no longer exists on nightly - // https://github.com/rust-lang/rust-clippy/issues/7768 - #[allow(clippy::semicolon_if_nothing_returned)] impl<'de, T, U $(, $typaram)*> DeserializeAs<'de, $ty> for $ty where U: DeserializeAs<'de, T>, @@ -442,10 +438,6 @@ macro_rules! map_impl { $ty:ident < K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)* >, $with_capacity:expr ) => { - // Fix for clippy regression in macros on stable - // The bug no longer exists on nightly - // https://github.com/rust-lang/rust-clippy/issues/7768 - #[allow(clippy::semicolon_if_nothing_returned)] impl<'de, K, V, KU, VU $(, $typaram)*> DeserializeAs<'de, $ty> for $ty where KU: DeserializeAs<'de, K>, diff --git a/serde_with/src/serde_conv.rs b/serde_with/src/serde_conv.rs index f8ddefd8..39b3f63a 100644 --- a/serde_with/src/serde_conv.rs +++ b/serde_with/src/serde_conv.rs @@ -111,7 +111,6 @@ macro_rules! serde_conv { $vis struct $m; const _:() = { - #[allow(clippy::ptr_arg)] impl $m { $vis fn serialize(x: &$t, serializer: S) -> $crate::__private__::Result where diff --git a/serde_with/src/utils.rs b/serde_with/src/utils.rs index 77baec4e..9bd42989 100644 --- a/serde_with/src/utils.rs +++ b/serde_with/src/utils.rs @@ -171,9 +171,6 @@ where // TODO could be simplified with nightly maybe_uninit_uninit_array feature // https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.uninit_array - // Clippy is broken and has a false positive here - // https://github.com/rust-lang/rust-clippy/issues/10551 - #[allow(clippy::uninit_assumed_init)] let mut arr: [MaybeUninit; N] = unsafe { MaybeUninit::uninit().assume_init() }; // Dropping a `MaybeUninit` does nothing. Thus using raw pointer diff --git a/serde_with/tests/base64.rs b/serde_with/tests/base64.rs index 881ee0d2..cb20fadc 100644 --- a/serde_with/tests/base64.rs +++ b/serde_with/tests/base64.rs @@ -1,9 +1,4 @@ #![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, // This allows the tests to be written more uniform and not have to special case the last clone(). clippy::redundant_clone, )] diff --git a/serde_with/tests/chrono_0_4.rs b/serde_with/tests/chrono_0_4.rs index e3998378..405f8a28 100644 --- a/serde_with/tests/chrono_0_4.rs +++ b/serde_with/tests/chrono_0_4.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - extern crate alloc; mod utils; diff --git a/serde_with/tests/derives/lib.rs b/serde_with/tests/derives/lib.rs index a43a3c35..9a2b6a9e 100644 --- a/serde_with/tests/derives/lib.rs +++ b/serde_with/tests/derives/lib.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - mod deserialize_fromstr; mod serialize_display; #[path = "../utils.rs"] diff --git a/serde_with/tests/hashbrown_0_14.rs b/serde_with/tests/hashbrown_0_14.rs index 6f3e1d01..2f1267e8 100644 --- a/serde_with/tests/hashbrown_0_14.rs +++ b/serde_with/tests/hashbrown_0_14.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - mod utils; use crate::utils::{check_deserialization, check_error_deserialization, is_equal}; diff --git a/serde_with/tests/hex.rs b/serde_with/tests/hex.rs index 2994ae47..0516ce68 100644 --- a/serde_with/tests/hex.rs +++ b/serde_with/tests/hex.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - mod utils; use crate::utils::{check_deserialization, check_error_deserialization, is_equal}; diff --git a/serde_with/tests/indexmap_1.rs b/serde_with/tests/indexmap_1.rs index 58e4c976..afb7ce82 100644 --- a/serde_with/tests/indexmap_1.rs +++ b/serde_with/tests/indexmap_1.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - mod utils; use crate::utils::{check_deserialization, check_error_deserialization, is_equal}; diff --git a/serde_with/tests/indexmap_2.rs b/serde_with/tests/indexmap_2.rs index 350a94c2..61edb10a 100644 --- a/serde_with/tests/indexmap_2.rs +++ b/serde_with/tests/indexmap_2.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - mod utils; use crate::utils::{check_deserialization, check_error_deserialization, is_equal}; diff --git a/serde_with/tests/json.rs b/serde_with/tests/json.rs index 1babc44f..9422e9b2 100644 --- a/serde_with/tests/json.rs +++ b/serde_with/tests/json.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - mod utils; use crate::utils::is_equal; diff --git a/serde_with/tests/rust.rs b/serde_with/tests/rust.rs index 8dfa91cb..cfda7f0d 100644 --- a/serde_with/tests/rust.rs +++ b/serde_with/tests/rust.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - extern crate alloc; mod utils; diff --git a/serde_with/tests/serde_as/lib.rs b/serde_with/tests/serde_as/lib.rs index cfe13c82..6ac1c385 100644 --- a/serde_with/tests/serde_as/lib.rs +++ b/serde_with/tests/serde_as/lib.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - extern crate alloc; mod collections; diff --git a/serde_with/tests/time_0_3.rs b/serde_with/tests/time_0_3.rs index 214ec39f..9067849d 100644 --- a/serde_with/tests/time_0_3.rs +++ b/serde_with/tests/time_0_3.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - mod utils; use crate::utils::{check_deserialization, check_error_deserialization, is_equal}; diff --git a/serde_with/tests/version_numbers.rs b/serde_with/tests/version_numbers.rs index ced72051..44cd3109 100644 --- a/serde_with/tests/version_numbers.rs +++ b/serde_with/tests/version_numbers.rs @@ -1,7 +1,3 @@ -// Needed to suppress a 2021 incompatibility warning in the macro generated code -// The non_fmt_panic lint is not yet available on most Rust versions -#![allow(unknown_lints, non_fmt_panics)] - use version_sync::{assert_contains_regex, assert_html_root_url_updated}; #[test] diff --git a/serde_with/tests/with_prefix.rs b/serde_with/tests/with_prefix.rs index 843be34a..2bf9e1d7 100644 --- a/serde_with/tests/with_prefix.rs +++ b/serde_with/tests/with_prefix.rs @@ -1,11 +1,3 @@ -#![allow( - // clippy is broken and shows wrong warnings - // clippy on stable does not know yet about the lint name - unknown_lints, - // https://github.com/rust-lang/rust-clippy/issues/8867 - clippy::derive_partial_eq_without_eq, -)] - extern crate alloc; mod utils; diff --git a/serde_with_macros/tests/version_numbers.rs b/serde_with_macros/tests/version_numbers.rs index ebb4a59f..b68030d2 100644 --- a/serde_with_macros/tests/version_numbers.rs +++ b/serde_with_macros/tests/version_numbers.rs @@ -1,7 +1,3 @@ -// Needed to supress a 2021 incompatability warning in the macro generated code -// The non_fmt_panic lint is not yet available on most Rust versions -#![allow(unknown_lints, non_fmt_panics)] - #[test] fn test_html_root_url() { version_sync::assert_html_root_url_updated!("src/lib.rs"); diff --git a/serde_with_test/tests/derive_display_fromstr.rs b/serde_with_test/tests/derive_display_fromstr.rs index 058fbf15..de2ec08a 100644 --- a/serde_with_test/tests/derive_display_fromstr.rs +++ b/serde_with_test/tests/derive_display_fromstr.rs @@ -2,7 +2,7 @@ // Ensure no prelude is available #![no_implicit_prelude] -#![allow(dead_code, unused_imports)] +#![allow(dead_code)] use ::s_with::{DeserializeFromStr, SerializeDisplay}; diff --git a/serde_with_test/tests/flattened_maybe.rs b/serde_with_test/tests/flattened_maybe.rs index 3b189754..3f5816c7 100644 --- a/serde_with_test/tests/flattened_maybe.rs +++ b/serde_with_test/tests/flattened_maybe.rs @@ -2,7 +2,7 @@ // Ensure no prelude is available #![no_implicit_prelude] -#![allow(dead_code, unused_imports)] +#![allow(dead_code)] // The macro creates custom deserialization code. // You need to specify a function name and the field name of the flattened field. diff --git a/serde_with_test/tests/serde_as_cfg.rs b/serde_with_test/tests/serde_as_cfg.rs index f4d88aff..e133ce77 100644 --- a/serde_with_test/tests/serde_as_cfg.rs +++ b/serde_with_test/tests/serde_as_cfg.rs @@ -2,7 +2,7 @@ // Ensure no prelude is available #![no_implicit_prelude] -#![allow(dead_code, unused_imports)] +#![allow(dead_code)] #[cfg_attr(test, ::cfg_eval::cfg_eval, ::s_with::serde_as(crate = "::s_with"))] #[cfg_attr(test, derive(::s::Serialize, ::s::Deserialize))] diff --git a/serde_with_test/tests/serde_conv.rs b/serde_with_test/tests/serde_conv.rs index 0a9ce86b..f5a956f9 100644 --- a/serde_with_test/tests/serde_conv.rs +++ b/serde_with_test/tests/serde_conv.rs @@ -2,7 +2,7 @@ // Ensure no prelude is available #![no_implicit_prelude] -#![allow(dead_code, unused_imports)] +#![allow(dead_code)] use ::s_with::serde_conv; diff --git a/serde_with_test/tests/with_prefix.rs b/serde_with_test/tests/with_prefix.rs index e3ca7c08..9ee2176a 100644 --- a/serde_with_test/tests/with_prefix.rs +++ b/serde_with_test/tests/with_prefix.rs @@ -2,7 +2,7 @@ // Ensure no prelude is available #![no_implicit_prelude] -#![allow(dead_code, unused_imports)] +#![allow(dead_code)] use ::s_with::with_prefix;