From 1afe5de56a07f565211c2b14c9a01b631c0ae8b4 Mon Sep 17 00:00:00 2001 From: Erin Power Date: Thu, 5 Dec 2024 11:39:05 +0100 Subject: [PATCH] Update to Rust 1.83.0 --- rust-toolchain.toml | 2 +- src/collections/ttl.rs | 2 +- src/config/watch.rs | 8 ++++---- src/filters/firewall/config.rs | 4 ++-- src/metrics.rs | 2 +- src/net/maxmind_db.rs | 7 ++++--- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 460612ae6e..28a9f87ca4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -13,5 +13,5 @@ # limitations under the License. [toolchain] -channel = "1.81.0" +channel = "1.83.0" components = ["rustfmt", "clippy"] diff --git a/src/collections/ttl.rs b/src/collections/ttl.rs index f2da7a1d0a..c6cb015f98 100644 --- a/src/collections/ttl.rs +++ b/src/collections/ttl.rs @@ -313,7 +313,7 @@ pub enum Entry<'a, K, V> { Vacant(VacantEntry<'a, K, V>), } -impl<'a, K, V> OccupiedEntry<'a, K, Value> +impl OccupiedEntry<'_, K, Value> where K: Eq + Hash, { diff --git a/src/config/watch.rs b/src/config/watch.rs index defee055b7..6b944f2771 100644 --- a/src/config/watch.rs +++ b/src/config/watch.rs @@ -136,13 +136,13 @@ pub struct ReadGuard<'inner, T: Watchable + std::fmt::Debug> { marker: Marker, } -impl<'inner, T: Watchable + std::fmt::Debug> Drop for ReadGuard<'inner, T> { +impl Drop for ReadGuard<'_, T> { fn drop(&mut self) { debug_assert!(!self.inner.has_changed(self.marker)); } } -impl<'inner, T: Watchable + std::fmt::Debug> std::ops::Deref for ReadGuard<'inner, T> { +impl std::ops::Deref for ReadGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -155,13 +155,13 @@ pub struct WatchGuard<'inner, T: Watchable + std::fmt::Debug> { marker: Marker, } -impl<'inner, T: Watchable + std::fmt::Debug> Drop for WatchGuard<'inner, T> { +impl Drop for WatchGuard<'_, T> { fn drop(&mut self) { self.inner.check_for_changes(self.marker); } } -impl<'inner, T: Watchable + std::fmt::Debug> std::ops::Deref for WatchGuard<'inner, T> { +impl std::ops::Deref for WatchGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { diff --git a/src/filters/firewall/config.rs b/src/filters/firewall/config.rs index fd58c465f9..6e696a2d06 100644 --- a/src/filters/firewall/config.rs +++ b/src/filters/firewall/config.rs @@ -224,7 +224,7 @@ impl<'de> Deserialize<'de> for PortRange { { struct PortRangeVisitor; - impl<'de> Visitor<'de> for PortRangeVisitor { + impl Visitor<'_> for PortRangeVisitor { type Value = PortRange; fn expecting(&self, f: &mut Formatter) -> Result<(), fmt::Error> { @@ -344,7 +344,7 @@ mod tests { let yaml = " on_read: - action: ALLOW - sources: + sources: - 192.168.51.0/24 ports: - 10 diff --git a/src/metrics.rs b/src/metrics.rs index 75019a8a66..beeb8820bf 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -83,7 +83,7 @@ pub struct AsnInfo<'a> { prefix: &'a str, } -impl<'a> AsnInfo<'a> { +impl AsnInfo<'_> { #[inline] fn asn_str(&self) -> &str { // SAFETY: we only write ASCII in itoa diff --git a/src/net/maxmind_db.rs b/src/net/maxmind_db.rs index 734841f51b..cf1013132d 100644 --- a/src/net/maxmind_db.rs +++ b/src/net/maxmind_db.rs @@ -53,10 +53,11 @@ impl std::str::FromStr for Source { fn from_str(input: &str) -> Result { if let Ok(url) = input.parse() { Ok(Self::Url { url }) - } else if let Ok(path) = input.parse() { - Ok(Self::File { path }) } else { - Err(eyre::eyre!("'{}' is not a valid URL or path", input)) + // Clippy says this parse is guarenteed to succeed. + Ok(Self::File { + path: input.parse().unwrap(), + }) } } }