diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-04-20 21:45:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-20 21:45:37 +0100 |
| commit | 418a07861a4f8832474fee6a4afe54810fb65439 (patch) | |
| tree | f906c5331b54eb4d649d892b2b5912429e45ff48 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 29ee2763680fb9a831cb33d80158f661cb508504 (diff) | |
| parent | fdf93bbde02ddaf2eb75b82a9ef4e8d5590f9c37 (diff) | |
| download | rust-418a07861a4f8832474fee6a4afe54810fb65439.tar.gz rust-418a07861a4f8832474fee6a4afe54810fb65439.zip | |
Rollup merge of #124103 - dtolnay:metadatadebug, r=Mark-Simulacrum
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());
}
```
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
