From e6668848c43c18a451ac336dc58ad374fbeb6399 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Thu, 5 Sep 2024 07:36:47 +0200 Subject: [PATCH 1/2] Deny use of dbg macro in library and test code Using this macro should be a temporary measure and not generate output from production code or tests. It cold be allowed for individual examples, if needed. --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 25242d1b..15e0457e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,7 @@ //! platform-specific port object which allows access to platform-specific functionality. #![deny( + clippy::dbg_macro, missing_docs, missing_debug_implementations, missing_copy_implementations From eb31575e2b54e69df9e8c78da060e51165b3b707 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Thu, 5 Sep 2024 07:51:38 +0200 Subject: [PATCH 2/2] Clean up dbg residue from clamping timeouts --- src/posix/poll.rs | 7 +------ src/windows/com.rs | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/posix/poll.rs b/src/posix/poll.rs index e193ac0e..36d05cb4 100644 --- a/src/posix/poll.rs +++ b/src/posix/poll.rs @@ -27,10 +27,7 @@ fn wait_fd(fd: RawFd, events: PollFlags, timeout: Duration) -> io::Result<()> { let wait = match poll_clamped(&mut fd, timeout) { Ok(r) => r, - Err(e) => { - dbg!(e); - return Err(io::Error::from(crate::Error::from(e))); - } + Err(e) => return Err(io::Error::from(crate::Error::from(e))), }; // All errors generated by poll or ppoll are already caught by the nix wrapper around libc, so // here we only need to check if there's at least 1 event @@ -116,7 +113,6 @@ mod tests { for (i, d) in MONOTONIC_DURATIONS.iter().enumerate() { let next = clamped_millis_c_int(*d); - dbg!((i, d)); assert!( next >= last, "{next} >= {last} failed for {d:?} at index {i}" @@ -136,7 +132,6 @@ mod tests { for (i, d) in MONOTONIC_DURATIONS.iter().enumerate() { let next = clamped_time_spec(*d); - dbg!((i, d)); assert!( next >= last, "{next} >= {last} failed for {d:?} at index {i}" diff --git a/src/windows/com.rs b/src/windows/com.rs index 21ed0486..fa1abbca 100644 --- a/src/windows/com.rs +++ b/src/windows/com.rs @@ -466,7 +466,6 @@ mod tests { for (i, d) in MONOTONIC_DURATIONS.iter().enumerate() { let next = COMPort::timeout_constant(*d); - dbg!((i, d)); assert!( next >= last, "{next} >= {last} failed for {d:?} at index {i}"