Skip to content

Commit

Permalink
Switch from allowing dead code to cfg(unix)
Browse files Browse the repository at this point in the history
Signed-off-by: J Robert Ray <[email protected]>
  • Loading branch information
jrray committed Jan 14, 2025
1 parent 208b237 commit 16a04b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
12 changes: 4 additions & 8 deletions crates/spfs/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ mod bootstrap_test;

/// Environment variable used to store the original value of HOME
/// when launching through certain shells (tcsh).
// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
const SPFS_ORIGINAL_HOME: &str = "SPFS_ORIGINAL_HOME";

/// The environment variable used to store the message
Expand Down Expand Up @@ -277,8 +276,7 @@ pub(crate) fn build_spfs_remove_durable_command(
})
}

// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
pub(crate) fn build_spfs_remount_command(rt: &runtime::Runtime) -> Result<Command> {
let exe = match which_spfs("enter") {
None => return Err(Error::MissingBinary("spfs-enter")),
Expand All @@ -300,8 +298,7 @@ pub(crate) fn build_spfs_remount_command(rt: &runtime::Runtime) -> Result<Comman
})
}

// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
pub(crate) fn build_spfs_exit_command(rt: &runtime::Runtime) -> Result<Command> {
let exe = match which_spfs("enter") {
None => return Err(Error::MissingBinary("spfs-enter")),
Expand All @@ -323,8 +320,7 @@ pub(crate) fn build_spfs_exit_command(rt: &runtime::Runtime) -> Result<Command>
})
}

// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
pub(crate) fn build_spfs_change_to_durable_command(rt: &runtime::Runtime) -> Result<Command> {
let exe = match which_spfs("enter") {
None => return Err(Error::MissingBinary("spfs-enter")),
Expand Down
3 changes: 1 addition & 2 deletions crates/spfs/src/repeating_timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ pin_project! {
#[derive(Debug, PartialEq, Eq)]
pub struct Elapsed(());

#[cfg(unix)]
impl<S: Stream> RepeatingTimeout<S> {
// Allow: not used on Windows.
#[allow(dead_code)]
pub(super) fn new(stream: S, duration: Duration) -> Self {
let next = Instant::now() + duration;
let deadline = tokio::time::sleep_until(next);
Expand Down
15 changes: 5 additions & 10 deletions crates/spfs/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ pub struct RenderResult {
///
/// The return value is defined only if the spfs-render output could be parsed
/// successfully into a [`RenderResult`].
// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
async fn render_via_subcommand(
spec: tracking::EnvSpec,
kept_runtime: bool,
Expand Down Expand Up @@ -207,8 +206,7 @@ pub async fn compute_object_manifest(
/// If `skip_runtime_save` is true, the runtime will not be saved, even if
/// the `flattened_layers` property is modified. Only pass true here if the
/// runtime is unconditionally saved shortly after calling this function.
// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
pub(crate) async fn resolve_overlay_dirs<R>(
runtime: &mut runtime::Runtime,
repo: R,
Expand All @@ -228,8 +226,7 @@ where
impl ResolvedManifest {
/// Iterate over all the "existing" manifests contained within this
/// manifest.
// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
fn existing(self) -> impl Iterator<Item = graph::Manifest> {
// Find all the `Existing` manifests in this recursive structure,
// returning them in an order based on their original order, to
Expand All @@ -249,8 +246,7 @@ where
result.into_iter().map(|(_, m)| m)
}

// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
fn manifest(&self) -> &graph::Manifest {
match self {
ResolvedManifest::Existing { manifest, .. } => manifest,
Expand Down Expand Up @@ -362,8 +358,7 @@ where
/// If `skip_runtime_save` is true, the runtime will not be saved, even if
/// the `flattened_layers` property is modified. Only pass true here if the
/// runtime is unconditionally saved shortly after calling this function.
// Allow: not used on Windows.
#[allow(dead_code)]
#[cfg(unix)]
pub(crate) async fn resolve_and_render_overlay_dirs(
runtime: &mut runtime::Runtime,
skip_runtime_save: bool,
Expand Down

0 comments on commit 16a04b5

Please sign in to comment.