Skip to content

Commit ab73d10

Browse files
committed
fix warnings with cfg(miri)
1 parent ca2ffe3 commit ab73d10

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/libcore/tests/hash/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ fn test_writer_hasher() {
7070
let ptr = 5_usize as *mut i32;
7171
assert_eq!(hash(&ptr), 5);
7272

73+
if cfg!(miri) { // Miri cannot hash pointers
74+
return;
75+
}
76+
7377
let cs: &mut [u8] = &mut [1, 2, 3];
7478
let ptr = cs.as_ptr();
7579
let slice_ptr = cs as *const [u8];
76-
#[cfg(not(miri))] // Miri cannot hash pointers
7780
assert_eq!(hash(&slice_ptr), hash(&ptr) + cs.len() as u64);
7881

7982
let slice_ptr = cs as *mut [u8];
80-
#[cfg(not(miri))] // Miri cannot hash pointers
8183
assert_eq!(hash(&slice_ptr), hash(&ptr) + cs.len() as u64);
8284
}
8385

src/libcore/tests/num/dec2flt/mod.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ fn ordinary() {
3131
test_literal!(0.1);
3232
test_literal!(12345.);
3333
test_literal!(0.9999999);
34-
#[cfg(not(miri))] // Miri is too slow
34+
35+
if cfg!(miri) { // Miri is too slow
36+
return;
37+
}
38+
3539
test_literal!(2.2250738585072014e-308);
3640
}
3741

@@ -77,9 +81,12 @@ fn infinity() {
7781
fn zero() {
7882
test_literal!(0.0);
7983
test_literal!(1e-325);
80-
#[cfg(not(miri))] // Miri is too slow
84+
85+
if cfg!(miri) { // Miri is too slow
86+
return;
87+
}
88+
8189
test_literal!(1e-326);
82-
#[cfg(not(miri))] // Miri is too slow
8390
test_literal!(1e-500);
8491
}
8592

0 commit comments

Comments
 (0)