mirror of
https://github.com/uutils/coreutils
synced 2024-12-04 02:19:54 +00:00
Merge pull request #6840 from jesseschalken/reuse-metadata-instead-of-path-is-dir
du: Reuse existing metadata instead of calling path.is_dir() again
This commit is contained in:
commit
763306ccc1
1 changed files with 2 additions and 2 deletions
|
@ -171,7 +171,7 @@ impl Stat {
|
|||
Ok(Self {
|
||||
path: path.to_path_buf(),
|
||||
is_dir: metadata.is_dir(),
|
||||
size: if path.is_dir() { 0 } else { metadata.len() },
|
||||
size: if metadata.is_dir() { 0 } else { metadata.len() },
|
||||
blocks: metadata.blocks(),
|
||||
inodes: 1,
|
||||
inode: Some(file_info),
|
||||
|
@ -189,7 +189,7 @@ impl Stat {
|
|||
Ok(Self {
|
||||
path: path.to_path_buf(),
|
||||
is_dir: metadata.is_dir(),
|
||||
size: if path.is_dir() { 0 } else { metadata.len() },
|
||||
size: if metadata.is_dir() { 0 } else { metadata.len() },
|
||||
blocks: size_on_disk / 1024 * 2,
|
||||
inodes: 1,
|
||||
inode: file_info,
|
||||
|
|
Loading…
Reference in a new issue