diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2024-12-17 14:33:10 -0800 |
|---|---|---|
| committer | Josh Triplett <josh@joshtriplett.org> | 2024-12-17 14:33:10 -0800 |
| commit | a105cd606628b07e79ab343cc183a176e278c809 (patch) | |
| tree | 051f572eb6a1fcf3cb4541d4c427e0c13d02a8bd /library/std/src/sys | |
| parent | a4cb3c831823d9baa56c3d90514b75b2660116fa (diff) | |
| download | rust-a105cd606628b07e79ab343cc183a176e278c809.tar.gz rust-a105cd606628b07e79ab343cc183a176e278c809.zip | |
Use field init shorthand where possible
Field init shorthand allows writing initializers like `tcx: tcx` as `tcx`. The compiler already uses it extensively. Fix the last few places where it isn't yet used.
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/pal/hermit/fs.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/pal/hermit/thread.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/pal/hermit/time.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/pal/sgx/fd.rs | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/sys/pal/hermit/fs.rs b/library/std/src/sys/pal/hermit/fs.rs index 88fc4068719..783623552bb 100644 --- a/library/std/src/sys/pal/hermit/fs.rs +++ b/library/std/src/sys/pal/hermit/fs.rs @@ -135,7 +135,7 @@ impl FileAttr { S_IFREG => DT_REG, _ => DT_UNKNOWN, }; - FileType { mode: mode } + FileType { mode } } } diff --git a/library/std/src/sys/pal/hermit/thread.rs b/library/std/src/sys/pal/hermit/thread.rs index 2a0b8dcb4ed..4a7afddbec1 100644 --- a/library/std/src/sys/pal/hermit/thread.rs +++ b/library/std/src/sys/pal/hermit/thread.rs @@ -43,7 +43,7 @@ impl Thread { } Err(io::const_error!(io::ErrorKind::Uncategorized, "Unable to create thread!")) } else { - Ok(Thread { tid: tid }) + Ok(Thread { tid }) }; extern "C" fn thread_start(main: usize) { diff --git a/library/std/src/sys/pal/hermit/time.rs b/library/std/src/sys/pal/hermit/time.rs index e0b6eb76b03..f76a5f96c87 100644 --- a/library/std/src/sys/pal/hermit/time.rs +++ b/library/std/src/sys/pal/hermit/time.rs @@ -22,7 +22,7 @@ impl Timespec { const fn new(tv_sec: i64, tv_nsec: i32) -> Timespec { assert!(tv_nsec >= 0 && tv_nsec < NSEC_PER_SEC); // SAFETY: The assert above checks tv_nsec is within the valid range - Timespec { t: timespec { tv_sec: tv_sec, tv_nsec: tv_nsec } } + Timespec { t: timespec { tv_sec, tv_nsec } } } fn sub_timespec(&self, other: &Timespec) -> Result<Duration, Duration> { diff --git a/library/std/src/sys/pal/sgx/fd.rs b/library/std/src/sys/pal/sgx/fd.rs index c41b527cff7..3bb3189a1d1 100644 --- a/library/std/src/sys/pal/sgx/fd.rs +++ b/library/std/src/sys/pal/sgx/fd.rs @@ -12,7 +12,7 @@ pub struct FileDesc { impl FileDesc { pub fn new(fd: Fd) -> FileDesc { - FileDesc { fd: fd } + FileDesc { fd } } pub fn raw(&self) -> Fd { |
