Skip to content

Commit 9504311

Browse files
authored
Rollup merge of #127355 - aceArt-GmbH:126475, r=oli-obk
Mark format! with must_use hint Uses unstable feature rust-lang/rust#94745 Part of #126475 First contribution to rust, please let me know if the blessing of tests is correct Thanks `@bjorn3` for the help
2 parents 27c53bd + 83fae11 commit 9504311

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Diff for: tests/pass/intptrcast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn cast_dangling() {
3535
fn format() {
3636
// Pointer string formatting! We can't check the output as it changes when libstd changes,
3737
// but we can make sure Miri does not error.
38-
format!("{:?}", &mut 13 as *mut _);
38+
let _ = format!("{:?}", &mut 13 as *mut _);
3939
}
4040

4141
fn transmute() {
@@ -52,7 +52,7 @@ fn ptr_bitops1() {
5252
let one = bytes.as_ptr().wrapping_offset(1);
5353
let three = bytes.as_ptr().wrapping_offset(3);
5454
let res = (one as usize) | (three as usize);
55-
format!("{}", res);
55+
let _ = format!("{}", res);
5656
}
5757

5858
fn ptr_bitops2() {

Diff for: tests/pass/packed_struct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn test_derive() {
138138
assert_eq!(x.partial_cmp(&y).unwrap(), x.cmp(&y));
139139
x.hash(&mut DefaultHasher::new());
140140
P::default();
141-
format!("{:?}", x);
141+
let _ = format!("{:?}", x);
142142
}
143143

144144
fn main() {

Diff for: tests/pass/shims/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ fn test_errors() {
202202
// Opening a non-existing file should fail with a "not found" error.
203203
assert_eq!(ErrorKind::NotFound, File::open(&path).unwrap_err().kind());
204204
// Make sure we can also format this.
205-
format!("{0}: {0:?}", File::open(&path).unwrap_err());
205+
let _ = format!("{0}: {0:?}", File::open(&path).unwrap_err());
206206
// Removing a non-existing file should fail with a "not found" error.
207207
assert_eq!(ErrorKind::NotFound, remove_file(&path).unwrap_err().kind());
208208
// Reading the metadata of a non-existing file should fail with a "not found" error.
@@ -301,5 +301,5 @@ fn test_from_raw_os_error() {
301301
let error = Error::from_raw_os_error(code);
302302
assert!(matches!(error.kind(), ErrorKind::Uncategorized));
303303
// Make sure we can also format this.
304-
format!("{error:?}");
304+
let _ = format!("{error:?}");
305305
}

Diff for: tests/pass/shims/io.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ fn main() {
1515
panic!("unsupported OS")
1616
};
1717
let err = io::Error::from_raw_os_error(raw_os_error);
18-
format!("{err}: {err:?}");
18+
let _ = format!("{err}: {err:?}");
1919
}

Diff for: tests/pass/vecdeque.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ fn main() {
3131
}
3232

3333
// Regression test for Debug impl's
34-
format!("{:?} {:?}", dst, dst.iter());
35-
format!("{:?}", VecDeque::<u32>::new().iter());
34+
let _ = format!("{:?} {:?}", dst, dst.iter());
35+
let _ = format!("{:?}", VecDeque::<u32>::new().iter());
3636

3737
for a in dst {
3838
assert_eq!(*a, 2);

0 commit comments

Comments
 (0)