src/pxar/encoder.rs: refactor simple match statements to map_err()
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
6e1c31163b
commit
0d70535a36
@ -83,10 +83,8 @@ impl <'a, W: Write> Encoder<'a, W> {
|
|||||||
// todo: use scandirat??
|
// todo: use scandirat??
|
||||||
|
|
||||||
let dir_fd = dir.as_raw_fd();
|
let dir_fd = dir.as_raw_fd();
|
||||||
let stat = match nix::sys::stat::fstat(dir_fd) {
|
let stat = nix::sys::stat::fstat(dir_fd)
|
||||||
Ok(stat) => stat,
|
.map_err(|err| format_err!("fstat {:?} failed - {}", path, err))?;
|
||||||
Err(err) => bail!("fstat {:?} failed - {}", path, err),
|
|
||||||
};
|
|
||||||
|
|
||||||
if !is_directory(&stat) {
|
if !is_directory(&stat) {
|
||||||
bail!("got unexpected file type {:?} (not a directory)", path);
|
bail!("got unexpected file type {:?} (not a directory)", path);
|
||||||
|
Loading…
Reference in New Issue
Block a user