Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mise.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tools]
rust = { version = "1.94.1", profile = "default" }
rust = { version = "1.95.0", profile = "default" }
"aqua:EmbarkStudios/cargo-deny" = "0.19.4"
"github:xd009642/tarpaulin" = "0.35.2"
usage = "3.2.0"
Expand Down
14 changes: 6 additions & 8 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,12 @@ impl OutputMode {

/// Returns true when an environment variable is set to a truthy value.
fn env_flag_is_truthy(name: &str) -> bool {
env::var(name)
.map(|value| {
matches!(
value.trim().to_ascii_lowercase().as_str(),
"1" | "true" | "yes" | "on"
)
})
.unwrap_or(false)
env::var(name).is_ok_and(|value| {
matches!(
value.trim().to_ascii_lowercase().as_str(),
"1" | "true" | "yes" | "on"
)
})
}

#[cfg(test)]
Expand Down
14 changes: 6 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,12 @@ fn print_error(error: &Report, debug_error_report: bool) {

/// Returns true when an environment variable is set to a truthy value.
fn env_flag_is_truthy(name: &str) -> bool {
env::var(name)
.map(|value| {
matches!(
value.trim().to_ascii_lowercase().as_str(),
"1" | "true" | "yes" | "on"
)
})
.unwrap_or(false)
env::var(name).is_ok_and(|value| {
matches!(
value.trim().to_ascii_lowercase().as_str(),
"1" | "true" | "yes" | "on"
)
})
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/ssh/client/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Method {
pub fn with_key_file<T: AsRef<Path>>(key_file_path: T, passphrase: Option<&str>) -> Self {
Self::PrivateKeyFile {
key_file_path: key_file_path.as_ref().to_path_buf(),
key_pass: passphrase.map(str::to_string),
key_pass: passphrase.map(str::to_owned),
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/ssh/client/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ pub(super) async fn execute(
ChannelMsg::Data { data } => {
stdout_buffer.extend_from_slice(&data);
}
ChannelMsg::ExtendedData { data, ext } => {
if ext == 1 {
stderr_buffer.extend_from_slice(&data);
}
ChannelMsg::ExtendedData { data, ext } if ext == 1 => {
stderr_buffer.extend_from_slice(&data);
}
ChannelMsg::ExitStatus {
exit_status: status,
Expand Down
14 changes: 5 additions & 9 deletions src/ssh/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,11 @@ async fn upload_file(
}

if matches!(permissions, SftpPermissions::Recreate) {
let should_remove = sftp
.metadata(sftp_path)
.await
.map(|attrs| {
attrs
.permissions
.map_or_else(|| true, |p| (p & 0o777) != secure_mode)
})
.unwrap_or(true); // Default to true if metadata fails
let should_remove = sftp.metadata(sftp_path).await.map_or(true, |attrs| {
attrs
.permissions
.map_or_else(|| true, |p| (p & 0o777) != secure_mode)
}); // Default to true if metadata fails
if should_remove && let Err(e) = sftp.remove_file(sftp_path).await {
debug!(error = %e, path = sftp_path, "Failed to remove pre-existing file or file did not exist");
}
Expand Down
Loading