1
Fork 0
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:
Fort 2015-12-30 10:06:24 -08:00
parent 6c3917e123
commit 04d2134856

View file

@ -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)
} }