Skip to content

Commit

Permalink
Update to Rust 1.83.0 (#1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky authored Dec 5, 2024
1 parent 632ec6a commit b702a91
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

[toolchain]
channel = "1.81.0"
channel = "1.83.0"
components = ["rustfmt", "clippy"]
2 changes: 1 addition & 1 deletion src/collections/ttl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ pub enum Entry<'a, K, V> {
Vacant(VacantEntry<'a, K, V>),
}

impl<'a, K, V> OccupiedEntry<'a, K, Value<V>>
impl<K, V> OccupiedEntry<'_, K, Value<V>>
where
K: Eq + Hash,
{
Expand Down
8 changes: 4 additions & 4 deletions src/config/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Watchable + std::fmt::Debug> 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<T: Watchable + std::fmt::Debug> std::ops::Deref for ReadGuard<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
Expand All @@ -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<T: Watchable + std::fmt::Debug> 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<T: Watchable + std::fmt::Debug> std::ops::Deref for WatchGuard<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
Expand Down
4 changes: 2 additions & 2 deletions src/filters/firewall/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -344,7 +344,7 @@ mod tests {
let yaml = "
on_read:
- action: ALLOW
sources:
sources:
- 192.168.51.0/24
ports:
- 10
Expand Down
2 changes: 1 addition & 1 deletion src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/net/maxmind_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ impl std::str::FromStr for Source {
fn from_str(input: &str) -> Result<Self, Self::Err> {
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(),
})
}
}
}
Expand Down

0 comments on commit b702a91

Please sign in to comment.