Skip to content

Commit

Permalink
fix: turborepo unused code lints (#4727)
Browse files Browse the repository at this point in the history
### Description

Mostly gating constants and imports behind `#[cfg(windows)]`.

One question for @arlyon is if we should delete the two methods on
`BumpTimeout` that appear unused. I did a search and I didn't find any
uses in the codebase, but wasn't sure if these will be used in some
future PR.

### Testing Instructions

Windows still builds on CI
  • Loading branch information
chris-olszewski committed Apr 27, 2023
1 parent 7375f53 commit bbeeeb4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/globwatch/src/lib.rs
Expand Up @@ -36,7 +36,7 @@ pub use notify::{Error, Event, Watcher};
pub use stop_token::{stream::StreamExt, StopSource, StopToken, TimedOutError};
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
use tokio_stream::wrappers::UnboundedReceiverStream;
use tracing::{event, span, trace, warn, Id, Level, Span};
use tracing::{event, span, trace, warn, Id, Level};

/// A wrapper around notify that allows for glob-based watching.
#[derive(Debug)]
Expand Down
2 changes: 2 additions & 0 deletions crates/turborepo-lib/src/daemon/bump_timeout.rs
Expand Up @@ -32,10 +32,12 @@ impl BumpTimeout {
Duration::from_millis(self.deadline.load(Ordering::Relaxed))
}

#[allow(dead_code)]
pub fn deadline(&self) -> Instant {
self.start + self.duration()
}

#[allow(dead_code)]
pub fn elapsed(&self) -> Duration {
self.start.elapsed()
}
Expand Down
14 changes: 5 additions & 9 deletions crates/turborepo-lib/src/daemon/endpoint.rs
@@ -1,11 +1,6 @@
use std::{
io::ErrorKind,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration,
};
use std::sync::{atomic::AtomicBool, Arc};
#[cfg(windows)]
use std::{io::ErrorKind, sync::atomic::Ordering, time::Duration};

use futures::Stream;
use tokio::io::{AsyncRead, AsyncWrite};
Expand All @@ -21,6 +16,7 @@ pub enum SocketOpenError {
LockError(#[from] pidlock::PidlockError),
}

#[cfg(windows)]
const WINDOWS_POLL_DURATION: Duration = Duration::from_millis(1);

/// Gets a stream of incoming connections from a Unix socket.
Expand All @@ -31,7 +27,7 @@ const WINDOWS_POLL_DURATION: Duration = Duration::from_millis(1);
/// code path to shut down the non-blocking polling
pub async fn open_socket(
path: AbsoluteSystemPathBuf,
running: Arc<AtomicBool>,
#[allow(unused)] running: Arc<AtomicBool>,
) -> Result<
(
pidlock::Pidlock,
Expand Down

0 comments on commit bbeeeb4

Please sign in to comment.