fix: apply suggestions from 1.71 clippy beta

Pull-Request: #4009.
This commit is contained in:
Thomas Eizinger
2023-05-30 15:30:04 +02:00
committed by GitHub
parent efb117e236
commit ddc2b879e2
6 changed files with 9 additions and 9 deletions

View File

@ -134,7 +134,7 @@ impl Behaviour {
"/ipfs/0.1.0".into(), "/ipfs/0.1.0".into(),
local_pub_key, local_pub_key,
)), )),
keep_alive: keep_alive::Behaviour::default(), keep_alive: keep_alive::Behaviour,
} }
} }
} }

View File

@ -25,7 +25,7 @@ impl<In, Out> Codec<In, Out> {
uvi.set_max_len(max_message_len_bytes); uvi.set_max_len(max_message_len_bytes);
Self { Self {
uvi, uvi,
phantom: PhantomData::default(), phantom: PhantomData,
} }
} }
} }

View File

@ -5099,7 +5099,7 @@ fn test_msg_id_fn_only_called_once_with_fast_message_ids() {
} }
let message_id_fn = |m: &Message| -> MessageId { let message_id_fn = |m: &Message| -> MessageId {
let (mut id, mut counters_pointer): (MessageId, *mut Pointers) = let (mut id, counters_pointer): (MessageId, *mut Pointers) =
get_counters_and_hash!(&m.data); get_counters_and_hash!(&m.data);
unsafe { unsafe {
(*counters_pointer).slow_counter += 1; (*counters_pointer).slow_counter += 1;
@ -5108,7 +5108,7 @@ fn test_msg_id_fn_only_called_once_with_fast_message_ids() {
id id
}; };
let fast_message_id_fn = |m: &RawMessage| -> FastMessageId { let fast_message_id_fn = |m: &RawMessage| -> FastMessageId {
let (id, mut counters_pointer) = get_counters_and_hash!(&m.data); let (id, counters_pointer) = get_counters_and_hash!(&m.data);
unsafe { unsafe {
(*counters_pointer).fast_counter += 1; (*counters_pointer).fast_counter += 1;
} }

View File

@ -649,7 +649,7 @@ impl PeerScore {
} }
let peers: Vec<_> = { let peers: Vec<_> = {
let mut record = self let record = self
.deliveries .deliveries
.entry(msg_id.clone()) .entry(msg_id.clone())
.or_insert_with(DeliveryRecord::default); .or_insert_with(DeliveryRecord::default);

View File

@ -202,7 +202,7 @@ impl Behaviour {
fn new(config: identify::Config) -> Self { fn new(config: identify::Config) -> Self {
Self { Self {
identify: identify::Behaviour::new(config), identify: identify::Behaviour::new(config),
keep_alive: keep_alive::Behaviour::default(), keep_alive: keep_alive::Behaviour,
} }
} }
} }

View File

@ -166,7 +166,7 @@ where
type Item = io::Result<Bytes>; type Item = io::Result<Bytes>;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
let mut this = Pin::into_inner(self); let this = Pin::into_inner(self);
loop { loop {
trace!("read state: {:?}", this.read_state); trace!("read state: {:?}", this.read_state);
match this.read_state { match this.read_state {
@ -265,7 +265,7 @@ where
type Error = io::Error; type Error = io::Error;
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
let mut this = Pin::into_inner(self); let this = Pin::into_inner(self);
loop { loop {
trace!("write state {:?}", this.write_state); trace!("write state {:?}", this.write_state);
match this.write_state { match this.write_state {
@ -321,7 +321,7 @@ where
fn start_send(self: Pin<&mut Self>, frame: &Vec<u8>) -> Result<(), Self::Error> { fn start_send(self: Pin<&mut Self>, frame: &Vec<u8>) -> Result<(), Self::Error> {
assert!(frame.len() <= MAX_FRAME_LEN); assert!(frame.len() <= MAX_FRAME_LEN);
let mut this = Pin::into_inner(self); let this = Pin::into_inner(self);
assert!(this.write_state.is_ready()); assert!(this.write_state.is_ready());
this.write_buffer this.write_buffer