Skip to content

Commit f8aba29

Browse files
committed
chore: fix warnings on win32
1 parent e97d7d3 commit f8aba29

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub async fn is_executable(path: impl AsRef<Path>) -> Result<bool> {
129129
meta.permissions().mode() & 0o100 != 0
130130
};
131131
#[cfg(not(unix))]
132-
let has_executable_flag = |meta: Metadata| true;
132+
let has_executable_flag = |_meta: Metadata| true;
133133

134134
fs::metadata(path.as_ref())
135135
.await

src/tools.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -631,21 +631,29 @@ mod archive {
631631
}
632632

633633
/// Set the executable flag for a file. Only has an effect on UNIX platforms.
634+
#[cfg(not(unix))]
635+
fn set_file_permissions(
636+
_file: &mut File,
637+
_mode: u32,
638+
_file_path_hint: impl Display,
639+
) -> Result<()> {
640+
Ok(())
641+
}
642+
643+
/// Set the executable flag for a file. Only has an effect on UNIX platforms.
644+
#[cfg(unix)]
634645
fn set_file_permissions(
635646
file: &mut File,
636647
mode: u32,
637648
file_path_hint: impl Display,
638649
) -> Result<()> {
639-
#[cfg(unix)]
640-
{
641-
use std::fs::Permissions;
642-
use std::os::unix::fs::PermissionsExt;
650+
use std::fs::Permissions;
651+
use std::os::unix::fs::PermissionsExt;
643652

644-
tracing::debug!("Setting permission of '{file_path_hint}' to {mode:#o}");
653+
tracing::debug!("Setting permission of '{file_path_hint}' to {mode:#o}");
645654

646-
file.set_permissions(Permissions::from_mode(mode))
647-
.context("failed setting file permissions")?;
648-
}
655+
file.set_permissions(Permissions::from_mode(mode))
656+
.context("failed setting file permissions")?;
649657

650658
Ok(())
651659
}

0 commit comments

Comments
 (0)