Skip to content

Commit

Permalink
chore: Enable the renamed_function_params lint (#2327)
Browse files Browse the repository at this point in the history
And fix all the warnings.
  • Loading branch information
larseggert authored Jan 9, 2025
1 parent d84f14d commit 17c4103
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pedantic = { level = "warn", priority = -1 }
if_then_some_else_none = "warn"
get_unwrap = "warn"
pathbuf_init_then_push = "warn"
renamed_function_params = "warn"

# Optimize build dependencies, because bindgen and proc macros / style
# compilation take more to run than to build otherwise.
Expand Down
8 changes: 4 additions & 4 deletions neqo-transport/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,17 +732,17 @@ pub struct CryptoState {
impl Index<CryptoDxDirection> for CryptoState {
type Output = CryptoDxState;

fn index(&self, dir: CryptoDxDirection) -> &Self::Output {
match dir {
fn index(&self, index: CryptoDxDirection) -> &Self::Output {
match index {
CryptoDxDirection::Read => &self.rx,
CryptoDxDirection::Write => &self.tx,
}
}
}

impl IndexMut<CryptoDxDirection> for CryptoState {
fn index_mut(&mut self, dir: CryptoDxDirection) -> &mut Self::Output {
match dir {
fn index_mut(&mut self, index: CryptoDxDirection) -> &mut Self::Output {
match index {
CryptoDxDirection::Read => &mut self.rx,
CryptoDxDirection::Write => &mut self.tx,
}
Expand Down
8 changes: 4 additions & 4 deletions neqo-transport/src/ecn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ impl Sub<Self> for Count {
type Output = Self;

/// Subtract the ECN counts in `other` from `self`.
fn sub(self, other: Self) -> Self {
fn sub(self, rhs: Self) -> Self {
let mut diff = Self::default();
for (ecn, count) in &mut *diff {
*count = self[ecn].saturating_sub(other[ecn]);
*count = self[ecn].saturating_sub(rhs[ecn]);
}
diff
}
}

impl AddAssign<IpTosEcn> for Count {
fn add_assign(&mut self, ecn: IpTosEcn) {
self[ecn] += 1;
fn add_assign(&mut self, rhs: IpTosEcn) {
self[rhs] += 1;
}
}

Expand Down
16 changes: 8 additions & 8 deletions neqo-transport/src/fc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,17 +500,17 @@ impl RemoteStreamLimits {
impl Index<StreamType> for RemoteStreamLimits {
type Output = RemoteStreamLimit;

fn index(&self, idx: StreamType) -> &Self::Output {
match idx {
fn index(&self, index: StreamType) -> &Self::Output {
match index {
StreamType::BiDi => &self.bidirectional,
StreamType::UniDi => &self.unidirectional,
}
}
}

impl IndexMut<StreamType> for RemoteStreamLimits {
fn index_mut(&mut self, idx: StreamType) -> &mut Self::Output {
match idx {
fn index_mut(&mut self, index: StreamType) -> &mut Self::Output {
match index {
StreamType::BiDi => &mut self.bidirectional,
StreamType::UniDi => &mut self.unidirectional,
}
Expand Down Expand Up @@ -555,17 +555,17 @@ impl LocalStreamLimits {
impl Index<StreamType> for LocalStreamLimits {
type Output = SenderFlowControl<StreamType>;

fn index(&self, idx: StreamType) -> &Self::Output {
match idx {
fn index(&self, index: StreamType) -> &Self::Output {
match index {
StreamType::BiDi => &self.bidirectional,
StreamType::UniDi => &self.unidirectional,
}
}
}

impl IndexMut<StreamType> for LocalStreamLimits {
fn index_mut(&mut self, idx: StreamType) -> &mut Self::Output {
match idx {
fn index_mut(&mut self, index: StreamType) -> &mut Self::Output {
match index {
StreamType::BiDi => &mut self.bidirectional,
StreamType::UniDi => &mut self.unidirectional,
}
Expand Down
8 changes: 4 additions & 4 deletions neqo-transport/src/tracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ impl PacketNumberSpaceSet {
impl Index<PacketNumberSpace> for PacketNumberSpaceSet {
type Output = bool;

fn index(&self, space: PacketNumberSpace) -> &Self::Output {
&self.spaces[space]
fn index(&self, index: PacketNumberSpace) -> &Self::Output {
&self.spaces[index]
}
}

impl IndexMut<PacketNumberSpace> for PacketNumberSpaceSet {
fn index_mut(&mut self, space: PacketNumberSpace) -> &mut Self::Output {
&mut self.spaces[space]
fn index_mut(&mut self, index: PacketNumberSpace) -> &mut Self::Output {
&mut self.spaces[index]
}
}

Expand Down
4 changes: 2 additions & 2 deletions test-fixture/src/sim/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ impl Node for ConnectionNode {
self.setup_goals(now);
}

fn process(&mut self, mut dgram: Option<Datagram>, now: Instant) -> Output {
fn process(&mut self, mut d: Option<Datagram>, now: Instant) -> Output {
_ = self.process_goals(|goal, c| goal.process(c, now));
loop {
let res = self.c.process(dgram.take(), now);
let res = self.c.process(d.take(), now);

let mut active = false;
while let Some(e) = self.c.next_event() {
Expand Down

0 comments on commit 17c4103

Please sign in to comment.