Skip to content

Fix clippy errors#301

Merged
jxs merged 4 commits into
sigp:masterfrom
ackintosh:fix-clippy-errors
Apr 28, 2026
Merged

Fix clippy errors#301
jxs merged 4 commits into
sigp:masterfrom
ackintosh:fix-clippy-errors

Conversation

@ackintosh

@ackintosh ackintosh commented Apr 27, 2026

Copy link
Copy Markdown
Member

Description

This PR fixes the following clippy errors:

It also removes unnecessary mut usages in:

Note: in b13cb7c, changed PendingNode::value() and PendingEntry::value() were updated to avoid requiring mutable access unnecessarily. Previously, the following code caused a compilation error at service.rs:623:

kbucket::Entry::Pending(ref entry, _) if entry.value().seq() < enr_seq => {
//                                       ^^^^^ cannot borrow immutable local variable `entry` as mutable
    let enr = entry.value().clone();
    to_request_enr = Some(enr);
}

Notes & open questions

Change checklist

  • Self-review
  • Documentation updates if relevant
  • Tests if relevant

Collapses the inner `if` into the outer `match` arm as a guard,
removing the unneeded `mut`.

Fixes clippy::collapsible_match:
https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#collapsible_match
PendingNode::value() and PendingEntry::value() unnecessarily required mutable access.
Changed both to take &self to fix clippy errors at call sites where `entry` is bound as an immutable reference, causing: "cannot borrow immutable local variable `entry` as mutable" on service.rs line:623.

Fixes clippy::collapsible_match:
https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#collapsible_match
@jxs jxs marked this pull request as ready for review April 28, 2026 09:04

@jxs jxs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Akihito, we are touching public API's which I feel don't need to be public, let's address that on a future PR before releasing a new minor version

@jxs jxs merged commit a4b8f02 into sigp:master Apr 28, 2026
7 checks passed
@ackintosh ackintosh deleted the fix-clippy-errors branch April 28, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants