Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(*): make clippy happy #1582

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions iroh-net/src/derp/http/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,8 +1125,6 @@ impl PacketForwarder for Client {
tokio::spawn(async move {
// attempt to send the packet 3 times
for _ in 0..3 {
let srckey = srckey;
let dstkey = dstkey;
let packet = packet.clone();
debug!("forward packet");
if let Ok((client, _)) = packet_forwarder.connect().await {
Expand Down
24 changes: 15 additions & 9 deletions iroh-net/src/magicsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1366,15 +1366,21 @@ impl Actor {
async fn send_network(&mut self, transmits: Vec<quinn_udp::Transmit>) {
trace!(
"sending:\n{}",
transmits
.iter()
.map(|t| format!(
" dest: {}, src: {:?}, content_len: {}\n",
QuicMappedAddr(t.destination),
t.src_ip,
t.contents.len()
))
.collect::<String>()
transmits.iter().fold(
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, that is totally easy to read compared to before...

String::with_capacity(transmits.len() * 50),
|mut final_repr, t| {
final_repr.push_str(
format!(
" dest: {}, src: {:?}, content_len: {}\n",
QuicMappedAddr(t.destination),
t.src_ip,
t.contents.len()
)
.as_str(),
);
final_repr
}
)
);

if transmits.is_empty() {
Expand Down
1 change: 1 addition & 0 deletions iroh-net/src/netcheck/reportgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ async fn run_probe(
/// return a "204 No Content" response and checking if that's what we get.
///
/// The boolean return is whether we think we have a captive portal.
#[allow(clippy::unnecessary_unwrap)] // NOTE: clippy's suggestion makes the code a lot more complex
async fn check_captive_portal(dm: &DerpMap, preferred_derp: Option<u16>) -> Result<bool> {
// If we have a preferred DERP region with more than one node, try
// that; otherwise, pick a random one not marked as "Avoid".
Expand Down
2 changes: 1 addition & 1 deletion iroh-sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ impl From<SignedEntry> for Entry {

impl PartialOrd for SignedEntry {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.entry.id.partial_cmp(&other.entry.id)
Some(self.cmp(other))
}
}

Expand Down