about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-09 15:44:16 +0000
committerbors <bors@rust-lang.org>2025-02-09 15:44:16 +0000
commit124cc92199ffa924f6b4c7cc819a85b65e0c3984 (patch)
tree7618e5ba778c9a8083f526a72dc9414ced99df02 /library/std/src
parenta26e97be8826d408309fffbd8168362365719f50 (diff)
parent1fcae03369abb4c2cc180cd5a49e1f4440a81300 (diff)
downloadrust-124cc92199ffa924f6b4c7cc819a85b65e0c3984.tar.gz
rust-124cc92199ffa924f6b4c7cc819a85b65e0c3984.zip
Auto merge of #136751 - bjorn3:update_rustfmt, r=Mark-Simulacrum
Update bootstrap compiler and rustfmt

The rustfmt version we previously used formats things differently from what the latest nightly rustfmt does. This causes issues for subtrees that get formatted both in-tree and in their own repo. Updating the rustfmt used in-tree solves those issues. Also bumped the bootstrap compiler as the stage0 update command always updates both at the same
time.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/io/stdio/tests.rs7
-rw-r--r--library/std/src/os/windows/process.rs8
-rw-r--r--library/std/src/os/xous/ffi/definitions.rs66
-rw-r--r--library/std/src/sys/pal/itron/time/tests.rs30
-rw-r--r--library/std/src/sys/pal/windows/args/tests.rs8
-rw-r--r--library/std/src/sys_common/wtf8/tests.rs111
6 files changed, 120 insertions, 110 deletions
diff --git a/library/std/src/io/stdio/tests.rs b/library/std/src/io/stdio/tests.rs
index bf8f3a5adfb..e68d8c29fbc 100644
--- a/library/std/src/io/stdio/tests.rs
+++ b/library/std/src/io/stdio/tests.rs
@@ -159,7 +159,8 @@ where
     assert_eq!(rx2.recv().unwrap(), Release2); // release th2
     th2.join().unwrap();
     th1.join().unwrap();
-    assert_eq!(*log.lock().unwrap(), [
-        Start1, Acquire1, Start2, Release1, Acquire2, Release2, Acquire1, Release1
-    ]);
+    assert_eq!(
+        *log.lock().unwrap(),
+        [Start1, Acquire1, Start2, Release1, Acquire2, Release2, Acquire1, Release1]
+    );
 }
diff --git a/library/std/src/os/windows/process.rs b/library/std/src/os/windows/process.rs
index 0277b79b8b6..201274cf03a 100644
--- a/library/std/src/os/windows/process.rs
+++ b/library/std/src/os/windows/process.rs
@@ -590,10 +590,10 @@ impl<'a> ProcThreadAttributeListBuilder<'a> {
         value_ptr: *const T,
         value_size: usize,
     ) -> Self {
-        self.attributes.insert(attribute, ProcThreadAttributeValue {
-            ptr: value_ptr.cast::<c_void>(),
-            size: value_size,
-        });
+        self.attributes.insert(
+            attribute,
+            ProcThreadAttributeValue { ptr: value_ptr.cast::<c_void>(), size: value_size },
+        );
         self
     }
 
diff --git a/library/std/src/os/xous/ffi/definitions.rs b/library/std/src/os/xous/ffi/definitions.rs
index 1b16849af03..345005bcc78 100644
--- a/library/std/src/os/xous/ffi/definitions.rs
+++ b/library/std/src/os/xous/ffi/definitions.rs
@@ -126,36 +126,42 @@ impl From<i32> for Error {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl core::fmt::Display for Error {
     fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        write!(f, "{}", match self {
-            Error::NoError => "no error occurred",
-            Error::BadAlignment => "memory was not properly aligned",
-            Error::BadAddress => "an invalid address was supplied",
-            Error::OutOfMemory => "the process or service has run out of memory",
-            Error::MemoryInUse => "the requested address is in use",
-            Error::InterruptNotFound => "the requested interrupt does not exist on this platform",
-            Error::InterruptInUse => "the requested interrupt is currently in use",
-            Error::InvalidString => "the specified string was not formatted correctly",
-            Error::ServerExists => "a server with that address already exists",
-            Error::ServerNotFound => "the requetsed server could not be found",
-            Error::ProcessNotFound => "the target process does not exist",
-            Error::ProcessNotChild => "the requested operation can only be done on child processes",
-            Error::ProcessTerminated => "the target process has crashed",
-            Error::Timeout => "the requested operation timed out",
-            Error::InternalError => "an internal error occurred",
-            Error::ServerQueueFull => "the server has too many pending messages",
-            Error::ThreadNotAvailable => "the specified thread does not exist",
-            Error::UnhandledSyscall => "the kernel did not recognize that syscall",
-            Error::InvalidSyscall => "the syscall had incorrect parameters",
-            Error::ShareViolation => "an attempt was made to share memory twice",
-            Error::InvalidThread => "tried to resume a thread that was not ready",
-            Error::InvalidPid => "kernel attempted to use a pid that was not valid",
-            Error::AccessDenied => "no permission to perform the requested operation",
-            Error::UseBeforeInit => "attempt to use a service before initialization finished",
-            Error::DoubleFree => "the requested resource was freed twice",
-            Error::DebugInProgress => "kernel attempted to activate a thread being debugged",
-            Error::InvalidLimit => "process attempted to adjust an invalid limit",
-            Error::UnknownError => "an unknown error occurred",
-        })
+        write!(
+            f,
+            "{}",
+            match self {
+                Error::NoError => "no error occurred",
+                Error::BadAlignment => "memory was not properly aligned",
+                Error::BadAddress => "an invalid address was supplied",
+                Error::OutOfMemory => "the process or service has run out of memory",
+                Error::MemoryInUse => "the requested address is in use",
+                Error::InterruptNotFound =>
+                    "the requested interrupt does not exist on this platform",
+                Error::InterruptInUse => "the requested interrupt is currently in use",
+                Error::InvalidString => "the specified string was not formatted correctly",
+                Error::ServerExists => "a server with that address already exists",
+                Error::ServerNotFound => "the requetsed server could not be found",
+                Error::ProcessNotFound => "the target process does not exist",
+                Error::ProcessNotChild =>
+                    "the requested operation can only be done on child processes",
+                Error::ProcessTerminated => "the target process has crashed",
+                Error::Timeout => "the requested operation timed out",
+                Error::InternalError => "an internal error occurred",
+                Error::ServerQueueFull => "the server has too many pending messages",
+                Error::ThreadNotAvailable => "the specified thread does not exist",
+                Error::UnhandledSyscall => "the kernel did not recognize that syscall",
+                Error::InvalidSyscall => "the syscall had incorrect parameters",
+                Error::ShareViolation => "an attempt was made to share memory twice",
+                Error::InvalidThread => "tried to resume a thread that was not ready",
+                Error::InvalidPid => "kernel attempted to use a pid that was not valid",
+                Error::AccessDenied => "no permission to perform the requested operation",
+                Error::UseBeforeInit => "attempt to use a service before initialization finished",
+                Error::DoubleFree => "the requested resource was freed twice",
+                Error::DebugInProgress => "kernel attempted to activate a thread being debugged",
+                Error::InvalidLimit => "process attempted to adjust an invalid limit",
+                Error::UnknownError => "an unknown error occurred",
+            }
+        )
     }
 }
 
diff --git a/library/std/src/sys/pal/itron/time/tests.rs b/library/std/src/sys/pal/itron/time/tests.rs
index 28db4f8b679..d14035d9da4 100644
--- a/library/std/src/sys/pal/itron/time/tests.rs
+++ b/library/std/src/sys/pal/itron/time/tests.rs
@@ -8,24 +8,26 @@ fn reltim2dur(t: u64) -> Duration {
 fn test_dur2reltims() {
     assert_eq!(dur2reltims(reltim2dur(0)).collect::<Vec<_>>(), vec![]);
     assert_eq!(dur2reltims(reltim2dur(42)).collect::<Vec<_>>(), vec![42]);
-    assert_eq!(dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(), vec![
-        abi::TMAX_RELTIM
-    ]);
-    assert_eq!(dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(), vec![
-        abi::TMAX_RELTIM,
-        10000
-    ]);
+    assert_eq!(
+        dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(),
+        vec![abi::TMAX_RELTIM]
+    );
+    assert_eq!(
+        dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(),
+        vec![abi::TMAX_RELTIM, 10000]
+    );
 }
 
 #[test]
 fn test_dur2tmos() {
     assert_eq!(dur2tmos(reltim2dur(0)).collect::<Vec<_>>(), vec![0]);
     assert_eq!(dur2tmos(reltim2dur(42)).collect::<Vec<_>>(), vec![42]);
-    assert_eq!(dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(), vec![
-        abi::TMAX_RELTIM
-    ]);
-    assert_eq!(dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(), vec![
-        abi::TMAX_RELTIM,
-        10000
-    ]);
+    assert_eq!(
+        dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(),
+        vec![abi::TMAX_RELTIM]
+    );
+    assert_eq!(
+        dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(),
+        vec![abi::TMAX_RELTIM, 10000]
+    );
 }
diff --git a/library/std/src/sys/pal/windows/args/tests.rs b/library/std/src/sys/pal/windows/args/tests.rs
index 6d5c953cbd5..484a90ab056 100644
--- a/library/std/src/sys/pal/windows/args/tests.rs
+++ b/library/std/src/sys/pal/windows/args/tests.rs
@@ -47,10 +47,10 @@ fn whitespace_behavior() {
 fn genius_quotes() {
     chk(r#"EXE "" """#, &["EXE", "", ""]);
     chk(r#"EXE "" """"#, &["EXE", "", r#"""#]);
-    chk(r#"EXE "this is """all""" in the same argument""#, &[
-        "EXE",
-        r#"this is "all" in the same argument"#,
-    ]);
+    chk(
+        r#"EXE "this is """all""" in the same argument""#,
+        &["EXE", r#"this is "all" in the same argument"#],
+    );
     chk(r#"EXE "a"""#, &["EXE", r#"a""#]);
     chk(r#"EXE "a"" a"#, &["EXE", r#"a" a"#]);
     // quotes cannot be escaped in command names
diff --git a/library/std/src/sys_common/wtf8/tests.rs b/library/std/src/sys_common/wtf8/tests.rs
index bc06eaa2b8f..b57c99a8452 100644
--- a/library/std/src/sys_common/wtf8/tests.rs
+++ b/library/std/src/sys_common/wtf8/tests.rs
@@ -356,32 +356,32 @@ fn wtf8buf_from_iterator() {
     fn f(values: &[u32]) -> Wtf8Buf {
         values.iter().map(|&c| CodePoint::from_u32(c).unwrap()).collect::<Wtf8Buf>()
     }
-    assert_eq!(f(&[0x61, 0xE9, 0x20, 0x1F4A9]), Wtf8Buf {
-        bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(),
-        is_known_utf8: true
-    });
+    assert_eq!(
+        f(&[0x61, 0xE9, 0x20, 0x1F4A9]),
+        Wtf8Buf { bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(), is_known_utf8: true }
+    );
 
     assert_eq!(f(&[0xD83D, 0xDCA9]).bytes, b"\xF0\x9F\x92\xA9"); // Magic!
-    assert_eq!(f(&[0xD83D, 0x20, 0xDCA9]), Wtf8Buf {
-        bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(f(&[0xD800, 0xDBFF]), Wtf8Buf {
-        bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(f(&[0xD800, 0xE000]), Wtf8Buf {
-        bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(f(&[0xD7FF, 0xDC00]), Wtf8Buf {
-        bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(f(&[0x61, 0xDC00]), Wtf8Buf {
-        bytes: b"\x61\xED\xB0\x80".to_vec(),
-        is_known_utf8: false
-    });
+    assert_eq!(
+        f(&[0xD83D, 0x20, 0xDCA9]),
+        Wtf8Buf { bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        f(&[0xD800, 0xDBFF]),
+        Wtf8Buf { bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        f(&[0xD800, 0xE000]),
+        Wtf8Buf { bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        f(&[0xD7FF, 0xDC00]),
+        Wtf8Buf { bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        f(&[0x61, 0xDC00]),
+        Wtf8Buf { bytes: b"\x61\xED\xB0\x80".to_vec(), is_known_utf8: false }
+    );
     assert_eq!(f(&[0xDC00]), Wtf8Buf { bytes: b"\xED\xB0\x80".to_vec(), is_known_utf8: false });
 }
 
@@ -396,36 +396,36 @@ fn wtf8buf_extend() {
         string
     }
 
-    assert_eq!(e(&[0x61, 0xE9], &[0x20, 0x1F4A9]), Wtf8Buf {
-        bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(),
-        is_known_utf8: true
-    });
+    assert_eq!(
+        e(&[0x61, 0xE9], &[0x20, 0x1F4A9]),
+        Wtf8Buf { bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(), is_known_utf8: true }
+    );
 
     assert_eq!(e(&[0xD83D], &[0xDCA9]).bytes, b"\xF0\x9F\x92\xA9"); // Magic!
-    assert_eq!(e(&[0xD83D, 0x20], &[0xDCA9]), Wtf8Buf {
-        bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(e(&[0xD800], &[0xDBFF]), Wtf8Buf {
-        bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(e(&[0xD800], &[0xE000]), Wtf8Buf {
-        bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(e(&[0xD7FF], &[0xDC00]), Wtf8Buf {
-        bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(e(&[0x61], &[0xDC00]), Wtf8Buf {
-        bytes: b"\x61\xED\xB0\x80".to_vec(),
-        is_known_utf8: false
-    });
-    assert_eq!(e(&[], &[0xDC00]), Wtf8Buf {
-        bytes: b"\xED\xB0\x80".to_vec(),
-        is_known_utf8: false
-    });
+    assert_eq!(
+        e(&[0xD83D, 0x20], &[0xDCA9]),
+        Wtf8Buf { bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        e(&[0xD800], &[0xDBFF]),
+        Wtf8Buf { bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        e(&[0xD800], &[0xE000]),
+        Wtf8Buf { bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        e(&[0xD7FF], &[0xDC00]),
+        Wtf8Buf { bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        e(&[0x61], &[0xDC00]),
+        Wtf8Buf { bytes: b"\x61\xED\xB0\x80".to_vec(), is_known_utf8: false }
+    );
+    assert_eq!(
+        e(&[], &[0xDC00]),
+        Wtf8Buf { bytes: b"\xED\xB0\x80".to_vec(), is_known_utf8: false }
+    );
 }
 
 #[test]
@@ -556,9 +556,10 @@ fn wtf8_encode_wide() {
     let mut string = Wtf8Buf::from_str("aé ");
     string.push(CodePoint::from_u32(0xD83D).unwrap());
     string.push_char('💩');
-    assert_eq!(string.encode_wide().collect::<Vec<_>>(), vec![
-        0x61, 0xE9, 0x20, 0xD83D, 0xD83D, 0xDCA9
-    ]);
+    assert_eq!(
+        string.encode_wide().collect::<Vec<_>>(),
+        vec![0x61, 0xE9, 0x20, 0xD83D, 0xD83D, 0xDCA9]
+    );
 }
 
 #[test]