mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 05:57:46 +00:00
du: refactor to use ? shortcut
This commit is contained in:
parent
be79a70572
commit
8f67c8fef2
1 changed files with 11 additions and 15 deletions
|
@ -55,9 +55,8 @@ struct Stat {
|
||||||
|
|
||||||
impl Stat {
|
impl Stat {
|
||||||
fn new(path: PathBuf) -> Result<Stat> {
|
fn new(path: PathBuf) -> Result<Stat> {
|
||||||
match fs::symlink_metadata(&path) {
|
let metadata = fs::symlink_metadata(&path)?;
|
||||||
Ok(metadata) => {
|
Ok(Stat {
|
||||||
return Ok(Stat {
|
|
||||||
path: path,
|
path: path,
|
||||||
is_dir: metadata.is_dir(),
|
is_dir: metadata.is_dir(),
|
||||||
size: metadata.len(),
|
size: metadata.len(),
|
||||||
|
@ -68,9 +67,6 @@ impl Stat {
|
||||||
modified: metadata.mtime() as u64,
|
modified: metadata.mtime() as u64,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Err(e) => Err(e),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this takes `my_stat` to avoid having to stat files multiple times.
|
// this takes `my_stat` to avoid having to stat files multiple times.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue