Skip to content

Commit

Permalink
chore: fix windows clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
yihau committed Nov 29, 2023
1 parent c58fbf7 commit 9ce56a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions accounts-db/src/hardened_unpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ where
}

#[cfg(windows)]
#[allow(clippy::permissions_set_readonly_false)]
fn set_perms(dst: &Path, _mode: u32) -> std::io::Result<()> {
let mut perm = fs::metadata(dst)?.permissions();
perm.set_readonly(false);
Expand Down
11 changes: 3 additions & 8 deletions install/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ pub fn string_from_winreg_value(val: &winreg::RegValue) -> Option<String> {
let words = unsafe {
slice::from_raw_parts(val.bytes.as_ptr() as *const u16, val.bytes.len() / 2)
};
let mut s = if let Ok(s) = String::from_utf16(words) {
s
} else {
let Ok(mut s) = String::from_utf16(words) else {
return None;
};
while s.ends_with('\u{0}') {
Expand Down Expand Up @@ -392,14 +390,11 @@ fn add_to_path(new_path: &str) -> bool {
},
};

let old_path = if let Some(s) =
let Some(old_path) =
get_windows_path_var().unwrap_or_else(|err| panic!("Unable to get PATH: {}", err))
{
s
} else {
else {
return false;
};

if !old_path.contains(new_path) {
let mut new_path = new_path.to_string();
if !old_path.is_empty() {
Expand Down

0 comments on commit 9ce56a0

Please sign in to comment.