Skip to content

Commit 454f3c3

Browse files
authored
New clippys (#16)
* New clippys * Update cache
1 parent 9fcb22a commit 454f3c3

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

.github/workflows/cargo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
components: clippy, rustfmt
4040
override: true
4141
- name: Cache cargo registry
42-
uses: actions/cache@v1
42+
uses: actions/cache@v4
4343
with:
4444
path: ~/.cargo/registry
4545
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

src/association/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ impl Association {
13441344
}
13451345

13461346
fn handle_forward_tsn(&mut self, c: &ChunkForwardTsn) -> Result<Vec<Packet>> {
1347-
trace!("[{}] FwdTSN: {}", self.side, c.to_string());
1347+
trace!("[{}] FwdTSN: {}", self.side, c);
13481348

13491349
if !self.use_forward_tsn {
13501350
warn!("[{}] received FwdTSN but not enabled", self.side);
@@ -1981,11 +1981,7 @@ impl Association {
19811981
bytes_queued += s.get_num_bytes_in_reassembly_queue() as u32;
19821982
}
19831983

1984-
if bytes_queued >= self.max_receive_buffer_size {
1985-
0
1986-
} else {
1987-
self.max_receive_buffer_size - bytes_queued
1988-
}
1984+
self.max_receive_buffer_size.saturating_sub(bytes_queued)
19891985
}
19901986

19911987
/// gather_outbound gathers outgoing packets. The returned bool value set to

src/association/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl TimerTable {
9090
}
9191

9292
pub fn is_expired(&mut self, timer: Timer, after: Instant) -> (bool, bool, usize) {
93-
let expired = self.data[timer as usize].map_or(false, |x| x <= after);
93+
let expired = self.data[timer as usize].is_some_and(|x| x <= after);
9494
let mut failure = false;
9595
if expired {
9696
self.retrans[timer as usize] += 1;

src/packet.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ use std::fmt;
5050
///+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5151
///| Checksum |
5252
///+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53-
5453
pub(crate) const PACKET_HEADER_SIZE: usize = 12;
5554

5655
#[derive(Default, Debug)]

src/queue/payload_queue.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl PayloadQueue {
128128
}
129129

130130
pub(crate) fn mark_as_acked(&mut self, tsn: u32) -> usize {
131-
let n_bytes_acked = if let Some(c) = self.chunk_map.get_mut(&tsn) {
131+
if let Some(c) = self.chunk_map.get_mut(&tsn) {
132132
c.acked = true;
133133
c.retransmit = false;
134134
let n = c.user_data.len();
@@ -137,9 +137,7 @@ impl PayloadQueue {
137137
n
138138
} else {
139139
0
140-
};
141-
142-
n_bytes_acked
140+
}
143141
}
144142

145143
pub(crate) fn get_last_tsn_received(&self) -> Option<&u32> {

0 commit comments

Comments
 (0)