Skip to content

Commit

Permalink
Tune up lints for 1.83 Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Nov 28, 2024
1 parent 8cce411 commit 0e579e8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/allocation/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Manager {
/// provided [`FiveTuple`]s.
pub(crate) fn get_allocations_info(
&self,
five_tuples: &Option<Vec<FiveTuple>>,
five_tuples: Option<&Vec<FiveTuple>>,
) -> HashMap<FiveTuple, Info> {
let mut infos = HashMap::new();

Expand All @@ -59,7 +59,7 @@ impl Manager {
reason = "order doesn't matter here",
)]
for (five_tuple, alloc) in &self.allocations {
if five_tuples.as_ref().map_or(true, |f| f.contains(five_tuple)) {
if five_tuples.map_or(true, |f| f.contains(five_tuple)) {
drop(infos.insert(
*five_tuple,
Info::new(
Expand Down
2 changes: 1 addition & 1 deletion src/allocation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::{
},
};

use bytecodec::EncodeExt;
use bytecodec::EncodeExt as _;
use derive_more::Display;
use rand::random;
use stun_codec::{
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
clippy::derive_partial_eq_without_eq,
clippy::else_if_without_else,
clippy::empty_drop,
clippy::empty_line_after_outer_attr,
clippy::empty_structs_with_brackets,
clippy::equatable_if_let,
clippy::empty_enum_variants_with_brackets,
Expand All @@ -37,13 +36,11 @@
clippy::fallible_impl_from,
clippy::filetype_is_file,
clippy::float_cmp_const,
clippy::fn_to_numeric_cast,
clippy::fn_to_numeric_cast_any,
clippy::format_push_string,
clippy::get_unwrap,
clippy::if_then_some_else_none,
clippy::imprecise_flops,
clippy::index_refutable_slice,
clippy::infinite_loop,
clippy::iter_on_empty_collections,
clippy::iter_on_single_items,
Expand All @@ -53,7 +50,6 @@
clippy::large_stack_frames,
clippy::let_underscore_untyped,
clippy::lossy_float_literal,
clippy::manual_c_str_literals,
clippy::map_err_ignore,
clippy::mem_forget,
clippy::missing_assert_message,
Expand All @@ -67,6 +63,7 @@
clippy::needless_collect,
clippy::needless_pass_by_ref_mut,
clippy::needless_raw_strings,
clippy::non_zero_suggestions,
clippy::nonstandard_macro_braces,
clippy::option_if_let_else,
clippy::or_fun_call,
Expand All @@ -77,7 +74,6 @@
clippy::print_stderr,
clippy::print_stdout,
clippy::pub_without_shorthand,
clippy::ref_as_ptr,
clippy::rc_buffer,
clippy::rc_mutex,
clippy::read_zero_byte_vec,
Expand Down Expand Up @@ -118,6 +114,7 @@
clippy::unneeded_field_pattern,
clippy::unused_peekable,
clippy::unused_result_ok,
clippy::unused_trait_names,
clippy::unwrap_in_result,
clippy::unwrap_used,
clippy::use_debug,
Expand Down
4 changes: 3 additions & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ impl Server {
tx,
)) => {
let infos = allocation_manager
.get_allocations_info(&five_tuples);
.get_allocations_info(
five_tuples.as_ref(),
);
drop(tx.send(infos).await);
}
Err(RecvError::Closed) => {
Expand Down
6 changes: 3 additions & 3 deletions src/server/request.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//! Ingress [`Request`] handling.
use bytecodec::EncodeExt;
use bytecodec::EncodeExt as _;
use std::{
collections::HashMap,
marker::{Send, Sync},
net::SocketAddr,
sync::Arc,
};

use rand::{distributions::Alphanumeric, random, Rng};
use secrecy::{ExposeSecret, SecretString};
use rand::{distributions::Alphanumeric, random, Rng as _};
use secrecy::{ExposeSecret as _, SecretString};
use stun_codec::{
rfc5389::{
errors::{BadRequest, StaleNonce, Unauthorized, UnknownAttribute},
Expand Down
2 changes: 1 addition & 1 deletion src/transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::io;
use std::net::SocketAddr;

use async_trait::async_trait;
use bytecodec::DecodeExt;
use bytecodec::DecodeExt as _;
use derive_more::{Display, Error as StdError, From};
use stun_codec::{Message, MessageDecoder};
use tokio::net::{self, ToSocketAddrs};
Expand Down
4 changes: 2 additions & 2 deletions src/transport/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::{
};

use async_trait::async_trait;
use bytecodec::DecodeExt;
use bytecodec::DecodeExt as _;
use bytes::BytesMut;
use futures::StreamExt;
use futures::StreamExt as _;
use stun_codec::MessageDecoder;
use tokio::{
io::AsyncWriteExt as _,
Expand Down

0 comments on commit 0e579e8

Please sign in to comment.