From af22e9710234db3cfc16d8120b70bfd3a60cd09b Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Mon, 26 Oct 2026 17:57:54 -0700 Subject: [PATCH] Use `#[expect]` instead of `#[allow]` --- src/archive.rs | 2 +- src/database_metadata.rs | 1 - src/derive.rs | 13 ++++++------- src/entry.rs | 2 +- src/entry_info.rs | 4 ++-- src/float_ext.rs | 2 +- src/head.rs | 2 +- src/lib.rs | 2 +- src/metadata.rs | 2 +- src/rotation.rs | 2 +- src/signature.rs | 2 +- src/sort.rs | 2 +- src/subcommand/serve/tests.rs | 2 +- src/time.rs | 2 +- src/totals.rs | 2 +- 15 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/archive.rs b/src/archive.rs index 5795d518..c25d4202 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -1,7 +1,7 @@ use super::*; /// Filepack archive. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Encode, Decode, Magic)] #[deco(magic = MagicType::Archive)] pub(crate) struct Archive { diff --git a/src/database_metadata.rs b/src/database_metadata.rs index b1e2c3ac..9bfeebd9 100644 --- a/src/database_metadata.rs +++ b/src/database_metadata.rs @@ -1,6 +1,5 @@ use super::*; -#[allow(clippy::arbitrary_source_item_ordering)] #[derive(Copy, Clone, Debug, Eq, FromRepr, Ord, PartialEq, PartialOrd, VariantArray)] #[repr(u64)] pub(crate) enum DatabaseMetadata { diff --git a/src/derive.rs b/src/derive.rs index d4f2e532..416063cd 100644 --- a/src/derive.rs +++ b/src/derive.rs @@ -711,7 +711,7 @@ fn generic_schema() { #[test] fn json_enum() { /// Foo. - #[allow(dead_code)] + #[expect(dead_code)] #[skip_serializing_none] #[derive(Deserialize, Json)] #[serde(deny_unknown_fields, rename_all = "snake_case", tag = "type")] @@ -774,7 +774,7 @@ fn json_generic() { /// /// - Bar is non-empty. /// - Bar is full of love. - #[allow(dead_code)] + #[expect(dead_code)] #[derive(Deserialize, Json)] struct Foo { /// Bar. @@ -815,7 +815,7 @@ fn json_generic() { #[test] fn json_string() { /// Foo. - #[allow(dead_code)] + #[expect(dead_code)] #[derive(Json)] #[json(string)] struct Foo(u64); @@ -847,7 +847,6 @@ fn json_string() { #[test] fn json_string_enum() { /// Foo. - #[allow(dead_code)] #[derive(Deserialize, Json)] #[serde(rename_all = "kebab-case")] enum Foo { @@ -892,7 +891,7 @@ fn json_string_enum() { #[test] fn json_struct() { /// Foo. - #[allow(dead_code)] + #[expect(dead_code)] #[skip_serializing_none] #[derive(Deserialize, Json)] #[serde(deny_unknown_fields)] @@ -963,7 +962,7 @@ fn json_struct() { #[test] fn json_transparent() { /// Foo. - #[allow(dead_code)] + #[expect(dead_code)] #[serde_as] #[derive(Deserialize, Json)] #[serde(transparent)] @@ -1005,7 +1004,7 @@ fn json_transparent() { #[test] fn json_untagged() { /// Foo. - #[allow(dead_code)] + #[expect(dead_code)] #[derive(Deserialize, Json)] #[serde(untagged)] enum Foo { diff --git a/src/entry.rs b/src/entry.rs index eb1306f8..0b5667fc 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -1,7 +1,7 @@ use super::*; /// Entry in a directory. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Clone, Copy, Debug, Decode, Encode, PartialEq)] pub struct Entry { /// BLAKE3 hash of the entry's contents. diff --git a/src/entry_info.rs b/src/entry_info.rs index 9c785e6a..4a4bbbaa 100644 --- a/src/entry_info.rs +++ b/src/entry_info.rs @@ -1,10 +1,10 @@ use super::*; /// Type-specific directory entry information. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Clone, Copy, Debug, Decode, Encode, EnumDiscriminants, PartialEq)] #[strum_discriminants( - allow(clippy::arbitrary_source_item_ordering), + expect(clippy::arbitrary_source_item_ordering), derive(Display), name(EntryType), strum(serialize_all = "kebab-case") diff --git a/src/float_ext.rs b/src/float_ext.rs index 0cd2be2f..3d984c53 100644 --- a/src/float_ext.rs +++ b/src/float_ext.rs @@ -4,7 +4,7 @@ pub(crate) trait FloatExt { impl FloatExt for f64 { fn into_u64(self) -> Option { - #![allow( + #![expect( clippy::cast_possible_truncation, clippy::cast_precision_loss, clippy::cast_sign_loss diff --git a/src/head.rs b/src/head.rs index 70ded920..9c3c1c05 100644 --- a/src/head.rs +++ b/src/head.rs @@ -1,7 +1,7 @@ use super::*; /// The first byte of a deco-encoded byte string. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Debug, PartialEq)] pub(crate) enum Head { Small, diff --git a/src/lib.rs b/src/lib.rs index 651828d6..e5e898b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -575,7 +575,7 @@ fn initialize_tracing() -> Result<(), Box> { } #[cfg(not(target_os = "linux"))] - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] fn journal_layer() -> Result, Box> { Ok(None) } diff --git a/src/metadata.rs b/src/metadata.rs index 14186b94..2b8f169f 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -1,7 +1,7 @@ use super::*; /// Metadata describing a package's content. -#[allow(private_interfaces)] +#[expect(private_interfaces)] #[skip_serializing_none] #[derive(Clone, Debug, Default, Encode, Decode, Json, Magic, PartialEq, Serialize)] #[deco(magic = MagicType::Metadata)] diff --git a/src/rotation.rs b/src/rotation.rs index 9c11db0d..b25591fb 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -1,7 +1,7 @@ use super::*; /// Rotation to apply when displaying an image. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Clone, Copy, Debug, Decode, Default, Encode, PartialEq)] pub(crate) enum Rotation { /// No rotation. diff --git a/src/signature.rs b/src/signature.rs index 19e98b87..0cb39cab 100644 --- a/src/signature.rs +++ b/src/signature.rs @@ -1,7 +1,7 @@ use super::*; /// Ed25519 signature over an enveloped message. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive( Debug, Decode, Encode, DeserializeFromStr, Eq, Ord, PartialEq, PartialOrd, SerializeDisplay, )] diff --git a/src/sort.rs b/src/sort.rs index a45bba0c..959389da 100644 --- a/src/sort.rs +++ b/src/sort.rs @@ -1,7 +1,7 @@ use super::*; /// Package sort key. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Clone, Copy, Default, Deserialize, Display, EnumIter, Json, PartialEq)] #[serde(rename_all = "kebab-case")] #[strum(serialize_all = "kebab-case")] diff --git a/src/subcommand/serve/tests.rs b/src/subcommand/serve/tests.rs index 76e84888..0c54598b 100644 --- a/src/subcommand/serve/tests.rs +++ b/src/subcommand/serve/tests.rs @@ -299,7 +299,7 @@ impl TestRequestBuilder { struct TestServer { data_dir: Utf8PathBuf, router: Router, - #[allow(unused)] + #[expect(unused)] tempdir: TempDir, } diff --git a/src/time.rs b/src/time.rs index 8df51be3..90296aba 100644 --- a/src/time.rs +++ b/src/time.rs @@ -7,7 +7,7 @@ static TIME: LazyLock = LazyLock::new(|| { }); /// Point in time with varying precision. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Clone, Copy, Debug, Decode, DeserializeFromStr, Encode, PartialEq, SerializeDisplay)] pub(crate) enum Time { /// A year. diff --git a/src/totals.rs b/src/totals.rs index 5813aaa2..4395964a 100644 --- a/src/totals.rs +++ b/src/totals.rs @@ -4,7 +4,7 @@ use super::*; /// /// `files + directories` and `file_size + directory_size` must be less than /// 264. -#[allow(clippy::arbitrary_source_item_ordering)] +#[expect(clippy::arbitrary_source_item_ordering)] #[derive(Clone, Copy, Debug, Decode, Default, Encode, Json, PartialEq, Serialize)] #[deco(validate)] pub struct Totals {