Skip to content

Commit

Permalink
Apply clippy suggestions
Browse files Browse the repository at this point in the history
Changes that weren't automatically applied via --fix.

Signed-off-by: J Robert Ray <[email protected]>
  • Loading branch information
jrray committed Dec 3, 2024
1 parent ad67555 commit 208b237
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions crates/spfs-cli/common/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ impl Logging {

#[cfg(unix)]
let syslog_layer = self.syslog.then(|| {
let identity = std::ffi::CStr::from_bytes_with_nul(b"spfs\0")
.expect("identity value is valid CStr");
let identity = c"spfs";
let (options, facility) = Default::default();
let layer = fmt_layer().with_writer(
syslog_tracing::Syslog::new(identity, options, facility)
Expand Down
12 changes: 3 additions & 9 deletions crates/spfs-vfs/src/winfsp/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ impl Mount {
let Ok(relative) = path.strip_prefix(r"\\") else {
return None;
};
let Some(str_path) = relative.to_str() else {
return None;
};
let str_path = relative.to_str()?;

const TRIM_END: &[char] = &['/'];
let path = str_path.replace('\\', "/");
Expand All @@ -183,15 +181,11 @@ impl Mount {
return entry;
}
for step in path.split('/') {
let Some(current) = entry.take() else {
return None;
};
let current = entry.take()?;
let EntryKind::Tree = current.kind else {
return None;
};
let Some(child) = current.entries.get(step) else {
return None;
};
let child = current.entries.get(step)?;
entry = self
.inodes
.get(&child.user_data)
Expand Down
6 changes: 4 additions & 2 deletions crates/spfs-vfs/src/winfsp/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,10 @@ pub fn get_parent_pids(root: Option<u32>) -> std::result::Result<Vec<u32>, winfs
let no_more_files = HRESULT::from(ERROR_NO_MORE_FILES);
let snapshot = unsafe { CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, child)? };
let mut parents = HashMap::new();
let mut process = PROCESSENTRY32::default();
process.dwSize = std::mem::size_of::<PROCESSENTRY32>() as u32;
let mut process = PROCESSENTRY32 {
dwSize: std::mem::size_of::<PROCESSENTRY32>() as u32,
..Default::default()
};
loop {
match unsafe { Process32Next(snapshot, &mut process as *mut PROCESSENTRY32) } {
Ok(()) => {
Expand Down

0 comments on commit 208b237

Please sign in to comment.