Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#124103 - dtolnay:metadatadebug, r=Mark-Simu…
…lacrum Improve std::fs::Metadata Debug representation - Remove duplication of `mode` between `file_type` and `permissions`, which both involve operating on the same mode_t integer - Add `is_symlink` - Add `len` in bytes - Remove Ok wrapping around `modified`, `accessed`, `created`, which eliminates 6 useless lines <table> <tr><th>Before</th><th>After</th></tr> <tr><td> ```console Metadata { file_type: FileType( FileType { mode: 0o100600 (-rw-------), }, ), is_dir: false, is_file: true, permissions: Permissions( FilePermissions { mode: 0o100600 (-rw-------), }, ), modified: Ok( SystemTime { tv_sec: 1713402981, tv_nsec: 682983531, }, ), accessed: Ok( SystemTime { tv_sec: 1713402983, tv_nsec: 206999623, }, ), created: Ok( SystemTime { tv_sec: 1713402981, tv_nsec: 682983531, }, ), .. } ``` </td><td> ```console Metadata { file_type: FileType { is_file: true, is_dir: false, is_symlink: false, .. }, permissions: Permissions( FilePermissions { mode: 0o100600 (-rw-------), }, ), len: 2096, modified: SystemTime { tv_sec: 1713402981, tv_nsec: 682983531, }, accessed: SystemTime { tv_sec: 1713402983, tv_nsec: 206999623, }, created: SystemTime { tv_sec: 1713402981, tv_nsec: 682983531, }, .. } ``` </td></tr></table> Generated by: ```rust fn main() { println!("{:#?}", std::fs::metadata("Cargo.toml").unwrap()); } ```
- Loading branch information