mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-03 22:47:46 +00:00
Skip creating a new File object when getting file size
This commit is contained in:
parent
6c3917e123
commit
04d2134856
1 changed files with 1 additions and 2 deletions
|
@ -411,8 +411,7 @@ fn do_pass(path: &Path, generator_type: PassType,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_file_size(path: &Path) -> Result<u64, io::Error> {
|
fn get_file_size(path: &Path) -> Result<u64, io::Error> {
|
||||||
let file: File = try!(File::open(path));
|
let size: u64 = try!(fs::metadata(path)).len();
|
||||||
let size: u64 = try!(file.metadata()).len();
|
|
||||||
|
|
||||||
Ok(size)
|
Ok(size)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue