mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Skip creating a new File object when getting file size
This commit is contained in:
+1
-2
@@ -411,8 +411,7 @@ fn do_pass(path: &Path, generator_type: PassType,
|
||||
}
|
||||
|
||||
fn get_file_size(path: &Path) -> Result<u64, io::Error> {
|
||||
let file: File = try!(File::open(path));
|
||||
let size: u64 = try!(file.metadata()).len();
|
||||
let size: u64 = try!(fs::metadata(path)).len();
|
||||
|
||||
Ok(size)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user