Skip to content

Commit fe8bf06

Browse files
committed
fix clippy warnings
1 parent 985efb4 commit fe8bf06

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

examples/adstool.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,12 +754,12 @@ fn print_read_value(typ: VarType, buf: &[u8], hex: bool) {
754754
}
755755
VarType::Real => {
756756
let v = f32::from_le_bytes(buf[..4].try_into().expect("size"));
757-
println!("{}", v);
757+
println!("{v}");
758758
return;
759759
}
760760
VarType::Lreal => {
761761
let v = f64::from_le_bytes(buf[..8].try_into().expect("size"));
762-
println!("{}", v);
762+
println!("{v}");
763763
return;
764764
}
765765
VarType::Byte => buf[0] as i128,
@@ -773,9 +773,9 @@ fn print_read_value(typ: VarType, buf: &[u8], hex: bool) {
773773
};
774774
// Only reaches here for integer types
775775
if hex {
776-
println!("{:#x}", value);
776+
println!("{value:#x}");
777777
} else {
778-
println!("{}", value);
778+
println!("{value}");
779779
}
780780
}
781781

src/client.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,13 @@ impl Drop for Client {
149149
.get_mut()
150150
.expect("notification handle cache lock was poisoned");
151151

152-
// Remove our port from the router, if necessary.
153-
if self.source_port_opened {
154-
let mut close_port_msg = [1, 0, 2, 0, 0, 0, 0, 0];
155-
LE::write_u16(&mut close_port_msg[6..], self.source.port());
156-
157-
let _ = self.socket.write().map(|mut socket| socket.write_all(&close_port_msg));
152+
if let Ok(ref mut socket) = self.socket.write() {
153+
// Remove our port from the router, if necessary.
154+
if self.source_port_opened {
155+
let mut close_port_msg = [1, 0, 2, 0, 0, 0, 0, 0];
156+
LE::write_u16(&mut close_port_msg[6..], self.source.port());
157+
let _ = socket.write_all(&close_port_msg);
158+
}
158159
}
159160

160161
self.worker.stop();
@@ -482,14 +483,14 @@ impl ClientWorker {
482483

483484
let _ = socket.shutdown(Shutdown::Both);
484485

485-
let _ = pending.write().map(|mut pending| {
486+
if let Ok(ref mut pending) = pending.write() {
486487
let keys = pending.keys().cloned().collect_vec();
487488
for key in keys {
488489
if let Some(channel) = pending.remove(&key) {
489490
let _ = channel.send(None);
490491
};
491492
}
492-
});
493+
}
493494

494495
result
495496
});

src/notif.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl std::fmt::Debug for Notification {
6161
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6262
writeln!(f, "Notification [")?;
6363
for sample in self.samples() {
64-
writeln!(f, " {:?}", sample)?;
64+
writeln!(f, " {sample:?}")?;
6565
}
6666
write!(f, "]")
6767
}

0 commit comments

Comments
 (0)