minor style cleanup
The match condition has gotten a bit large, and the error case is a bit more concise with a pattern guard. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
7672150c4c
commit
4f133ceef7
@ -442,29 +442,28 @@ impl Archiver {
|
||||
nix::sys::stat::fstatat(dir_fd, file_name, nix::fcntl::AtFlags::AT_SYMLINK_NOFOLLOW)
|
||||
};
|
||||
|
||||
match self
|
||||
let match_result = self
|
||||
.patterns
|
||||
.matches(match_path.as_os_str().as_bytes(), || {
|
||||
Ok::<_, Errno>(match &stat_results {
|
||||
Some(result) => result.st_mode,
|
||||
None => stat_results.insert(get_file_mode()?).st_mode,
|
||||
})
|
||||
}) {
|
||||
});
|
||||
|
||||
match match_result {
|
||||
Ok(Some(MatchType::Exclude)) => continue,
|
||||
Ok(_) => (),
|
||||
Err(err) if err.not_found() => continue,
|
||||
Err(err) => {
|
||||
if err.not_found() {
|
||||
continue;
|
||||
} else {
|
||||
return Err(err).with_context(|| format!("stat failed on {:?}", full_path));
|
||||
}
|
||||
return Err(err).with_context(|| format!("stat failed on {full_path:?}"))
|
||||
}
|
||||
}
|
||||
|
||||
let stat = stat_results
|
||||
.map(Ok)
|
||||
.unwrap_or_else(get_file_mode)
|
||||
.with_context(|| format!("stat failed on {:?}", full_path))?;
|
||||
.with_context(|| format!("stat failed on {full_path:?}"))?;
|
||||
|
||||
self.entry_counter += 1;
|
||||
if self.entry_counter > self.entry_limit {
|
||||
|
@ -263,7 +263,7 @@ where
|
||||
let did_match = match match_result {
|
||||
Some(MatchType::Include) => true,
|
||||
Some(MatchType::Exclude) => false,
|
||||
_ => self.state.current_match,
|
||||
None => self.state.current_match,
|
||||
};
|
||||
|
||||
let extract_res = match (did_match, entry.kind()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user