From 03d9dabed31a55c69ea394e886b2ddb8763de271 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 1 Dec 2024 20:13:06 +1300 Subject: [PATCH] Clippy fixes --- Cargo.lock | 130 ++++++++++---------- crates/common/src/auth/oauth/oidc.rs | 2 +- crates/common/src/scripts/functions/mod.rs | 2 +- crates/common/src/scripts/plugins/lookup.rs | 2 +- crates/common/src/scripts/plugins/pyzor.rs | 4 +- crates/directory/src/core/principal.rs | 2 +- crates/directory/src/lib.rs | 4 +- crates/imap-proto/src/protocol/fetch.rs | 20 +-- crates/imap-proto/src/protocol/store.rs | 2 +- crates/jmap-proto/src/parser/base32.rs | 4 +- crates/jmap-proto/src/request/capability.rs | 2 +- crates/jmap-proto/src/types/property.rs | 2 +- crates/jmap/src/api/http.rs | 2 +- crates/jmap/src/api/management/report.rs | 2 +- crates/jmap/src/email/index.rs | 2 +- crates/jmap/src/sieve/set.rs | 1 + crates/nlp/src/tokenizers/word.rs | 2 +- crates/smtp/src/outbound/lookup.rs | 4 +- crates/smtp/src/outbound/mod.rs | 2 +- crates/store/src/backend/rocksdb/write.rs | 2 +- crates/store/src/lib.rs | 16 +-- crates/trc/src/atomics/bitset.rs | 2 +- crates/trc/src/ipc/collector.rs | 3 +- crates/trc/src/ipc/subscriber.rs | 2 +- crates/trc/src/serializers/json.rs | 2 +- crates/utils/src/config/utils.rs | 9 +- tests/src/directory/imap.rs | 7 +- 27 files changed, 115 insertions(+), 119 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7194367b..c1225800 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -323,9 +323,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb8f1d480b0ea3783ab015936d2a55c87e219676f0c0b7dec61494043f21857" +checksum = "df895a515f70646414f4b45c0b79082783b80552b373a68283012928df56f522" dependencies = [ "flate2", "futures-core", @@ -794,9 +794,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" +checksum = "b8ee0c1824c4dea5b5f81736aff91bae041d2c07ee1192bec91054e10e3e601e" dependencies = [ "arrayref", "arrayvec", @@ -1150,9 +1150,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" dependencies = [ "cc", ] @@ -1225,7 +1225,7 @@ dependencies = [ "reqwest 0.12.9", "ring 0.17.8", "rsa", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", @@ -1826,7 +1826,7 @@ dependencies = [ "pwhash", "regex", "reqwest 0.12.9", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pki-types", "scrypt", "serde", @@ -2532,9 +2532,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96512db27971c2c3eece70a1e106fbe6c87760234e31e8f7e5634912fe52794a" +checksum = "2cb8bc4c28d15ade99c7e90b219f30da4be5c88e586277e8cbe886beeb868ab2" dependencies = [ "typenum", ] @@ -2665,9 +2665,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "allocator-api2", "equivalent", @@ -3009,7 +3009,7 @@ dependencies = [ "http 1.1.0", "hyper 1.5.1", "hyper-util", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -3275,7 +3275,7 @@ dependencies = [ "nlp", "parking_lot", "rand 0.8.5", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "store", "tokio", @@ -3314,7 +3314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] @@ -3437,9 +3437,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jemalloc-sys" @@ -3601,9 +3601,9 @@ dependencies = [ [[package]] name = "konst" -version = "0.3.12" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed986a294ccbcc4cbb7de5a1cf8f62e2473d85cf220e72cb01afe20d49194481" +checksum = "b65f00fb3910881e52bf0850ae2a82aea411488a557e1c02820ceaa60963dce3" dependencies = [ "const_panic", "konst_kernel", @@ -3703,9 +3703,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.164" +version = "0.2.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" [[package]] name = "libloading" @@ -3785,9 +3785,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -3817,7 +3817,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] @@ -3906,7 +3906,7 @@ dependencies = [ "base64 0.22.1", "gethostname", "md5", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pki-types", "smtp-proto", "tokio", @@ -3949,7 +3949,7 @@ dependencies = [ "mail-send", "md5", "parking_lot", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "sieve-rs", "store", @@ -4796,7 +4796,7 @@ dependencies = [ "jmap_proto", "mail-parser", "mail-send", - "rustls 0.23.17", + "rustls 0.23.19", "store", "tokio", "tokio-rustls 0.26.0", @@ -4806,9 +4806,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "postgres-protocol" @@ -5001,9 +5001,9 @@ dependencies = [ [[package]] name = "psl" -version = "2.1.59" +version = "2.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b9bc1071e59efa5b4972b584daa069e80d5262ce1309718a2ab20dae5f84ca" +checksum = "68dcd6202774d99d3d1558ab22f3618bd94e70c9f029d9c03d7af582ea8f8846" dependencies = [ "psl-types", ] @@ -5095,7 +5095,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.0.0", - "rustls 0.23.17", + "rustls 0.23.19", "socket2", "thiserror 2.0.3", "tokio", @@ -5113,7 +5113,7 @@ dependencies = [ "rand 0.8.5", "ring 0.17.8", "rustc-hash 2.0.0", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pki-types", "slab", "thiserror 2.0.3", @@ -5363,7 +5363,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rand 0.8.5", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-native-certs 0.7.3", "rustls-pemfile 2.2.0", "rustls-pki-types", @@ -5508,7 +5508,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", @@ -5628,9 +5628,9 @@ dependencies = [ [[package]] name = "roaring" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4b84ba6e838ceb47b41de5194a60244fac43d9fe03b71dbe8c5a201081d6d1" +checksum = "f81dc953b2244ddd5e7860cb0bb2a790494b898ef321d4aff8e260efab60cc88" dependencies = [ "bytemuck", "byteorder", @@ -5659,9 +5659,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" dependencies = [ "const-oid", "digest 0.10.7", @@ -5867,9 +5867,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.17" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "once_cell", "ring 0.17.8", @@ -6319,7 +6319,7 @@ checksum = "1f606421e4a6012877e893c399822a4ed4b089164c5969424e1b9d1e66e6964b" dependencies = [ "const-oid", "digest 0.10.7", - "generic-array 1.1.0", + "generic-array 1.1.1", ] [[package]] @@ -6453,7 +6453,7 @@ dependencies = [ "rayon", "regex", "reqwest 0.12.9", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", @@ -6610,7 +6610,7 @@ dependencies = [ "rocksdb", "rusqlite", "rust-s3", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pki-types", "serde", "serde_json", @@ -6831,7 +6831,7 @@ dependencies = [ "rayon", "reqwest 0.12.9", "ring 0.17.8", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", @@ -7056,7 +7056,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pki-types", "tokio", ] @@ -7223,9 +7223,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -7234,9 +7234,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -7245,9 +7245,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", ] @@ -7355,9 +7355,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typewit" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fb9ae6a3cafaf0a5d14c2302ca525f9ae8e07a0f0e6949de88d882c37a6e24" +checksum = "d51dbd25812f740f45e2a9769f84711982e000483b13b73a8a1852e092abac8c" dependencies = [ "typewit_proc_macros", ] @@ -7459,9 +7459,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna 1.0.3", @@ -7523,7 +7523,7 @@ dependencies = [ "regex", "reqwest 0.12.9", "ring 0.17.8", - "rustls 0.23.17", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", @@ -8095,9 +8095,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", @@ -8107,9 +8107,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", @@ -8140,18 +8140,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", diff --git a/crates/common/src/auth/oauth/oidc.rs b/crates/common/src/auth/oauth/oidc.rs index 8cbf3b04..fc5ed046 100644 --- a/crates/common/src/auth/oauth/oidc.rs +++ b/crates/common/src/auth/oauth/oidc.rs @@ -139,7 +139,7 @@ where { struct AnyBoolVisitor; - impl<'de> Visitor<'de> for AnyBoolVisitor { + impl Visitor<'_> for AnyBoolVisitor { type Value = bool; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/crates/common/src/scripts/functions/mod.rs b/crates/common/src/scripts/functions/mod.rs index c08f9f8f..4f0fcd8f 100644 --- a/crates/common/src/scripts/functions/mod.rs +++ b/crates/common/src/scripts/functions/mod.rs @@ -144,7 +144,7 @@ pub trait ApplyString<'x> { fn transform(&self, f: impl Fn(&'_ str) -> Variable) -> Variable; } -impl<'x> ApplyString<'x> for Variable { +impl ApplyString<'_> for Variable { fn transform(&self, f: impl Fn(&'_ str) -> Variable) -> Variable { match self { Variable::String(s) => f(s), diff --git a/crates/common/src/scripts/plugins/lookup.rs b/crates/common/src/scripts/plugins/lookup.rs index 1d82ba93..af1fe484 100644 --- a/crates/common/src/scripts/plugins/lookup.rs +++ b/crates/common/src/scripts/plugins/lookup.rs @@ -344,7 +344,7 @@ async fn exec_remote_(ctx: &PluginContext<'_>) -> trc::Result { // Update expiration list.expires = Instant::now() + expires; - return Ok(list.entries.contains(item.as_ref()).into()); + Ok(list.entries.contains(item.as_ref()).into()) } else { trc::bail!(trc::SieveEvent::RuntimeError .into_err() diff --git a/crates/common/src/scripts/plugins/pyzor.rs b/crates/common/src/scripts/plugins/pyzor.rs index f5642418..6523f62b 100644 --- a/crates/common/src/scripts/plugins/pyzor.rs +++ b/crates/common/src/scripts/plugins/pyzor.rs @@ -165,7 +165,7 @@ pub trait PyzorCheck { fn pyzor_check_message(&self) -> String; } -impl<'x, W: Write> PyzorDigest for Message<'x> { +impl PyzorDigest for Message<'_> { fn pyzor_digest(&self, writer: W) -> W { let parts = self .parts @@ -181,7 +181,7 @@ impl<'x, W: Write> PyzorDigest for Message<'x> { } } -impl<'x> PyzorCheck for Message<'x> { +impl PyzorCheck for Message<'_> { fn pyzor_check_message(&self) -> String { let time = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) diff --git a/crates/directory/src/core/principal.rs b/crates/directory/src/core/principal.rs index 29665477..ead910b4 100644 --- a/crates/directory/src/core/principal.rs +++ b/crates/directory/src/core/principal.rs @@ -888,7 +888,7 @@ impl<'de> serde::Deserialize<'de> for StringOrU64 { { struct StringOrU64Visitor; - impl<'de> Visitor<'de> for StringOrU64Visitor { + impl Visitor<'_> for StringOrU64Visitor { type Value = StringOrU64; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/crates/directory/src/lib.rs b/crates/directory/src/lib.rs index 6bd13cdb..69f5109f 100644 --- a/crates/directory/src/lib.rs +++ b/crates/directory/src/lib.rs @@ -267,9 +267,7 @@ pub enum Permission { // WARNING: add new ids at the end (TODO: use static ids) } -pub type Permissions = Bitset< - { (Permission::COUNT + std::mem::size_of::() - 1) / std::mem::size_of::() }, ->; +pub type Permissions = Bitset<{ Permission::COUNT.div_ceil(std::mem::size_of::()) }>; pub const ROLE_ADMIN: u32 = u32::MAX; pub const ROLE_TENANT_ADMIN: u32 = u32::MAX - 1; diff --git a/crates/imap-proto/src/protocol/fetch.rs b/crates/imap-proto/src/protocol/fetch.rs index e8b397a8..22a74e72 100644 --- a/crates/imap-proto/src/protocol/fetch.rs +++ b/crates/imap-proto/src/protocol/fetch.rs @@ -226,7 +226,7 @@ pub struct BodyPartExtension<'x> { pub body_location: Option>, } -impl<'x> Address<'x> { +impl Address<'_> { pub fn serialize(&self, buf: &mut Vec) { match self { Address::Single(addr) => addr.serialize(buf), @@ -242,7 +242,7 @@ impl<'x> Address<'x> { } } -impl<'x> EmailAddress<'x> { +impl EmailAddress<'_> { pub fn serialize(&self, buf: &mut Vec) { buf.push(b'('); if let Some(name) = &self.name { @@ -280,7 +280,7 @@ impl<'x> EmailAddress<'x> { } } -impl<'x> AddressGroup<'x> { +impl AddressGroup<'_> { pub fn serialize(&self, buf: &mut Vec) { buf.extend_from_slice(b"(NIL NIL "); if let Some(name) = &self.name { @@ -482,7 +482,7 @@ impl<'x> BodyPart<'x> { } } -impl<'x> BodyPartFields<'x> { +impl BodyPartFields<'_> { pub fn serialize(&self, buf: &mut Vec) { quoted_or_literal_string_or_nil(buf, self.body_subtype.as_deref()); if let Some(body_parameters) = &self.body_parameters { @@ -523,7 +523,7 @@ impl<'x> BodyPartFields<'x> { } } -impl<'x> BodyPartExtension<'x> { +impl BodyPartExtension<'_> { pub fn serialize(&self, buf: &mut Vec) { if let Some((disposition, parameters)) = &self.body_disposition { buf.push(b'('); @@ -588,7 +588,7 @@ impl<'x> BodyPartExtension<'x> { } } -impl<'x> BodyContents<'x> { +impl BodyContents<'_> { pub fn into_owned<'y>(self) -> BodyContents<'y> { match self { BodyContents::Text(text) => BodyContents::Text(text.into_owned().into()), @@ -636,7 +636,7 @@ static DUMMY_ADDRESS: [Address; 1] = [Address::Single(EmailAddress { address: Cow::Borrowed("unknown@localhost"), })]; -impl<'x> Envelope<'x> { +impl Envelope<'_> { pub fn serialize(&self, buf: &mut Vec) { buf.push(b'('); quoted_rfc2822_or_nil(buf, &self.date); @@ -709,7 +709,7 @@ impl<'x> Envelope<'x> { } } -impl<'x> DataItem<'x> { +impl DataItem<'_> { pub fn serialize(&self, buf: &mut Vec) { match self { DataItem::Binary { @@ -848,7 +848,7 @@ impl<'x> DataItem<'x> { } } -impl<'x> FetchItem<'x> { +impl FetchItem<'_> { pub fn serialize(&self, buf: &mut Vec) { buf.extend_from_slice(b"* "); buf.extend_from_slice(self.id.to_string().as_bytes()); @@ -863,7 +863,7 @@ impl<'x> FetchItem<'x> { } } -impl<'x> ImapResponse for Response<'x> { +impl ImapResponse for Response<'_> { fn serialize(self) -> Vec { let mut buf = Vec::with_capacity(128); for item in &self.items { diff --git a/crates/imap-proto/src/protocol/store.rs b/crates/imap-proto/src/protocol/store.rs index 0371f81c..e4977056 100644 --- a/crates/imap-proto/src/protocol/store.rs +++ b/crates/imap-proto/src/protocol/store.rs @@ -28,7 +28,7 @@ pub struct Response<'x> { pub items: Vec>, } -impl<'x> ImapResponse for Response<'x> { +impl ImapResponse for Response<'_> { fn serialize(self) -> Vec { let mut buf = Vec::with_capacity(64); for item in &self.items { diff --git a/crates/jmap-proto/src/parser/base32.rs b/crates/jmap-proto/src/parser/base32.rs index 999b6980..08330662 100644 --- a/crates/jmap-proto/src/parser/base32.rs +++ b/crates/jmap-proto/src/parser/base32.rs @@ -43,7 +43,7 @@ impl<'x, 'y> JsonBase32Reader<'x, 'y> { } } -impl<'x, 'y> Iterator for JsonBase32Reader<'x, 'y> { +impl Iterator for JsonBase32Reader<'_, '_> { type Item = u8; fn next(&mut self) -> Option { let pos = self.pos % 5; @@ -62,4 +62,4 @@ impl<'x, 'y> Iterator for JsonBase32Reader<'x, 'y> { } } -impl<'x, 'y> Leb128Iterator for JsonBase32Reader<'x, 'y> {} +impl Leb128Iterator for JsonBase32Reader<'_, '_> {} diff --git a/crates/jmap-proto/src/request/capability.rs b/crates/jmap-proto/src/request/capability.rs index 51ab534d..8a1b8685 100644 --- a/crates/jmap-proto/src/request/capability.rs +++ b/crates/jmap-proto/src/request/capability.rs @@ -348,7 +348,7 @@ impl JsonObjectParser for Capability { } } -impl<'x> Parser<'x> { +impl Parser<'_> { fn error_capability(&mut self) -> trc::Error { if self.is_eof || self.skip_string() { trc::JmapEvent::UnknownCapability.into_err().details( diff --git a/crates/jmap-proto/src/types/property.rs b/crates/jmap-proto/src/types/property.rs index bc76da48..4ebb5653 100644 --- a/crates/jmap-proto/src/types/property.rs +++ b/crates/jmap-proto/src/types/property.rs @@ -706,7 +706,7 @@ impl JsonObjectParser for ObjectProperty { } } -impl<'x> Parser<'x> { +impl Parser<'_> { fn invalid_property(&mut self) -> trc::Result { if self.is_eof || self.skip_string() { Ok(Property::_T( diff --git a/crates/jmap/src/api/http.rs b/crates/jmap/src/api/http.rs index 09a37745..50e2851b 100644 --- a/crates/jmap/src/api/http.rs +++ b/crates/jmap/src/api/http.rs @@ -744,7 +744,7 @@ impl<'x> HttpContext<'x> { } } -impl<'x> ResolveVariable for HttpContext<'x> { +impl ResolveVariable for HttpContext<'_> { fn resolve_variable(&self, variable: u32) -> Variable<'_> { match variable { V_REMOTE_IP => self.session.remote_ip.to_string().into(), diff --git a/crates/jmap/src/api/management/report.rs b/crates/jmap/src/api/management/report.rs index 331e54ef..f80a745d 100644 --- a/crates/jmap/src/api/management/report.rs +++ b/crates/jmap/src/api/management/report.rs @@ -490,7 +490,7 @@ impl Contains for FailureDetails { } } -impl<'x> Contains for Feedback<'x> { +impl Contains for Feedback<'_> { fn contains(&self, text: &str) -> bool { // Check if any of the string fields contain the filter self.authentication_results() diff --git a/crates/jmap/src/email/index.rs b/crates/jmap/src/email/index.rs index 5aa3b3fa..b370f9ec 100644 --- a/crates/jmap/src/email/index.rs +++ b/crates/jmap/src/email/index.rs @@ -406,7 +406,7 @@ impl<'x> EmailIndexBuilder<'x> { } } -impl<'x> EmailIndexBuilder<'x> { +impl EmailIndexBuilder<'_> { pub fn build(self, batch: &mut BatchBuilder, account_id: u32, tenant_id: Option) { let options = if self.set { // Serialize metadata diff --git a/crates/jmap/src/sieve/set.rs b/crates/jmap/src/sieve/set.rs index 7ba9eec0..0f5f28e9 100644 --- a/crates/jmap/src/sieve/set.rs +++ b/crates/jmap/src/sieve/set.rs @@ -77,6 +77,7 @@ pub trait SieveScriptSet: Sync + Send { fail_if_active: bool, ) -> impl Future> + Send; + #[allow(clippy::type_complexity)] fn sieve_set_item( &self, changes_: Object, diff --git a/crates/nlp/src/tokenizers/word.rs b/crates/nlp/src/tokenizers/word.rs index 80482c7a..d9113da5 100644 --- a/crates/nlp/src/tokenizers/word.rs +++ b/crates/nlp/src/tokenizers/word.rs @@ -14,7 +14,7 @@ pub struct WordTokenizer<'x> { iterator: CharIndices<'x>, } -impl<'x> WordTokenizer<'x> { +impl WordTokenizer<'_> { pub fn new(text: &str, max_token_length: usize) -> WordTokenizer { WordTokenizer { max_token_length, diff --git a/crates/smtp/src/outbound/lookup.rs b/crates/smtp/src/outbound/lookup.rs index 8b66cc86..c3e7ab8e 100644 --- a/crates/smtp/src/outbound/lookup.rs +++ b/crates/smtp/src/outbound/lookup.rs @@ -194,7 +194,7 @@ pub trait ToNextHop { &'x self, domain: &'y str, max_mx: usize, - ) -> Option>>; + ) -> Option>>; } impl ToNextHop for Vec { @@ -202,7 +202,7 @@ impl ToNextHop for Vec { &'x self, domain: &'y str, max_mx: usize, - ) -> Option>> { + ) -> Option>> { if !self.is_empty() { // Obtain max number of MX hosts to process let mut remote_hosts = Vec::with_capacity(max_mx); diff --git a/crates/smtp/src/outbound/mod.rs b/crates/smtp/src/outbound/mod.rs index 7bd71e2f..e3886e00 100644 --- a/crates/smtp/src/outbound/mod.rs +++ b/crates/smtp/src/outbound/mod.rs @@ -218,7 +218,7 @@ pub enum NextHop<'x> { MX(&'x str), } -impl<'x> NextHop<'x> { +impl NextHop<'_> { #[inline(always)] fn hostname(&self) -> &str { match self { diff --git a/crates/store/src/backend/rocksdb/write.rs b/crates/store/src/backend/rocksdb/write.rs index 8f7dd69a..8c060ae2 100644 --- a/crates/store/src/backend/rocksdb/write.rs +++ b/crates/store/src/backend/rocksdb/write.rs @@ -152,7 +152,7 @@ enum CommitError { RocksDB(rocksdb::Error), } -impl<'x> RocksDBTransaction<'x> { +impl RocksDBTransaction<'_> { fn commit(&self) -> Result { let mut account_id = u32::MAX; let mut collection = u8::MAX; diff --git a/crates/store/src/lib.rs b/crates/store/src/lib.rs index 08585f17..431ccfa4 100644 --- a/crates/store/src/lib.rs +++ b/crates/store/src/lib.rs @@ -539,7 +539,7 @@ impl<'x> From<&'x str> for Value<'x> { } } -impl<'x> From for Value<'x> { +impl From for Value<'_> { fn from(value: String) -> Self { Self::Text(value.into()) } @@ -557,13 +557,13 @@ impl<'x> From> for Value<'x> { } } -impl<'x> From for Value<'x> { +impl From for Value<'_> { fn from(value: bool) -> Self { Self::Bool(value) } } -impl<'x> From for Value<'x> { +impl From for Value<'_> { fn from(value: i64) -> Self { Self::Integer(value) } @@ -579,19 +579,19 @@ impl From> for i64 { } } -impl<'x> From for Value<'x> { +impl From for Value<'_> { fn from(value: u64) -> Self { Self::Integer(value as i64) } } -impl<'x> From for Value<'x> { +impl From for Value<'_> { fn from(value: u32) -> Self { Self::Integer(value as i64) } } -impl<'x> From for Value<'x> { +impl From for Value<'_> { fn from(value: f64) -> Self { Self::Float(value) } @@ -603,13 +603,13 @@ impl<'x> From<&'x [u8]> for Value<'x> { } } -impl<'x> From> for Value<'x> { +impl From> for Value<'_> { fn from(value: Vec) -> Self { Self::Blob(value.into()) } } -impl<'x> Value<'x> { +impl Value<'_> { pub fn into_string(self) -> String { match self { Value::Text(s) => s.into_owned(), diff --git a/crates/trc/src/atomics/bitset.rs b/crates/trc/src/atomics/bitset.rs index 3e148ada..f5ce17b3 100644 --- a/crates/trc/src/atomics/bitset.rs +++ b/crates/trc/src/atomics/bitset.rs @@ -79,7 +79,7 @@ mod tests { use super::*; const TEST_SIZE: usize = 1000; - type TestBitset = AtomicBitset<{ (TEST_SIZE + USIZE_BITS - 1) / USIZE_BITS }>; + type TestBitset = AtomicBitset<{ TEST_SIZE.div_ceil(USIZE_BITS) }>; static BITSET: TestBitset = TestBitset::new(); #[test] diff --git a/crates/trc/src/ipc/collector.rs b/crates/trc/src/ipc/collector.rs index 2631b757..c63d00f2 100644 --- a/crates/trc/src/ipc/collector.rs +++ b/crates/trc/src/ipc/collector.rs @@ -21,8 +21,7 @@ use parking_lot::Mutex; use crate::*; -pub(crate) type GlobalInterests = - AtomicBitset<{ (TOTAL_EVENT_COUNT + USIZE_BITS - 1) / USIZE_BITS }>; +pub(crate) type GlobalInterests = AtomicBitset<{ TOTAL_EVENT_COUNT.div_ceil(USIZE_BITS) }>; pub(crate) static TRACE_INTERESTS: GlobalInterests = GlobalInterests::new(); pub(crate) type CollectorThread = JoinHandle<()>; diff --git a/crates/trc/src/ipc/subscriber.rs b/crates/trc/src/ipc/subscriber.rs index 7c03e1bf..5de9e0f8 100644 --- a/crates/trc/src/ipc/subscriber.rs +++ b/crates/trc/src/ipc/subscriber.rs @@ -19,7 +19,7 @@ use super::{ const MAX_BATCH_SIZE: usize = 32768; -pub type Interests = Box>; +pub type Interests = Box>; pub type EventBatch = Vec>>; #[derive(Debug)] diff --git a/crates/trc/src/serializers/json.rs b/crates/trc/src/serializers/json.rs index cc36ed3f..215a0477 100644 --- a/crates/trc/src/serializers/json.rs +++ b/crates/trc/src/serializers/json.rs @@ -127,7 +127,7 @@ impl>> Serialize for JsonEventSerializer { } } -impl<'x> Serialize for JsonEventSerializer> { +impl Serialize for JsonEventSerializer> { fn serialize(&self, serializer: S) -> Result where S: Serializer, diff --git a/crates/utils/src/config/utils.rs b/crates/utils/src/config/utils.rs index 504e5834..62fcadd8 100644 --- a/crates/utils/src/config/utils.rs +++ b/crates/utils/src/config/utils.rs @@ -108,7 +108,7 @@ impl Config { &'y self, prefix: impl AsKey, suffix: &'y str, - ) -> impl Iterator + 'x { + ) -> impl Iterator + 'x { let mut last_key = ""; let prefix = prefix.as_prefix(); @@ -130,14 +130,17 @@ impl Config { }) } - pub fn prefix<'x, 'y: 'x>(&'y self, prefix: impl AsKey) -> impl Iterator + 'x { + pub fn prefix<'x, 'y: 'x>(&'y self, prefix: impl AsKey) -> impl Iterator + 'x { let prefix = prefix.as_prefix(); self.keys .keys() .filter_map(move |key| key.strip_prefix(&prefix)) } - pub fn set_values<'x, 'y: 'x>(&'y self, prefix: impl AsKey) -> impl Iterator + 'x { + pub fn set_values<'x, 'y: 'x>( + &'y self, + prefix: impl AsKey, + ) -> impl Iterator + 'x { let prefix = prefix.as_prefix(); #[cfg(debug_assertions)] diff --git a/tests/src/directory/imap.rs b/tests/src/directory/imap.rs index 2d55e3e9..4e95c029 100644 --- a/tests/src/directory/imap.rs +++ b/tests/src/directory/imap.rs @@ -152,12 +152,7 @@ async fn accept_imap(stream: TcpStream, acceptor: Arc, in_flight: O let mut buf_u8 = vec![0u8; 1024]; - loop { - let br = if let Ok(br) = stream.read(&mut buf_u8).await { - br - } else { - break; - }; + while let Ok(br) = stream.read(&mut buf_u8).await { let buf = std::str::from_utf8(&buf_u8[0..br]).unwrap(); let (op, buf) = buf.split_once(' ').unwrap();