decoder: clippy (div_ceil, if let), which CI's -D warnings refused
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
@@ -29,7 +29,7 @@ pub struct Layout {
|
|||||||
impl Layout {
|
impl Layout {
|
||||||
/// Bytes the frame must carry for this signal to be read.
|
/// Bytes the frame must carry for this signal to be read.
|
||||||
pub fn needs(&self) -> usize {
|
pub fn needs(&self) -> usize {
|
||||||
self.byte + (self.length as usize + 7) / 8
|
self.byte + (self.length as usize).div_ceil(8)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The signal's value from a frame's data, or None when the frame is too short.
|
/// The signal's value from a frame's data, or None when the frame is too short.
|
||||||
|
|||||||
+2
-4
@@ -284,13 +284,11 @@ fn main() -> ExitCode {
|
|||||||
loop {
|
loop {
|
||||||
if sock.is_none() && last_open_try.elapsed() >= Duration::from_secs(2) {
|
if sock.is_none() && last_open_try.elapsed() >= Duration::from_secs(2) {
|
||||||
last_open_try = Instant::now();
|
last_open_try = Instant::now();
|
||||||
match socket::RxSocket::open(&iface, &ids, Duration::from_millis(100)) {
|
// Absent or down: the state says so, retried every 2 s.
|
||||||
Ok(s) => {
|
if let Ok(s) = socket::RxSocket::open(&iface, &ids, Duration::from_millis(100)) {
|
||||||
eprintln!("decoder: {iface} open");
|
eprintln!("decoder: {iface} open");
|
||||||
sock = Some(s);
|
sock = Some(s);
|
||||||
}
|
}
|
||||||
Err(_) => {} // absent or down: the state says so, retried every 2 s
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
match sock.as_ref().map(|s| s.recv()) {
|
match sock.as_ref().map(|s| s.recv()) {
|
||||||
Some(Ok(Some(f))) => {
|
Some(Ok(Some(f))) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user