Skip to content

Commit c874b46

Browse files
committed
tests: Use as *const _ instead of .as_ptr() in ptr fmt test
Because `.as_ptr()` changes the type of the pointer (e.g. `&[u8]` becomes `*const u8` instead of `*const [u8]`), and it can't be expected that different types will be formatted the same way.
1 parent 16ea589 commit c874b46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

coretests/tests/fmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ fn test_format_flags() {
1515
fn test_pointer_formats_data_pointer() {
1616
let b: &[u8] = b"";
1717
let s: &str = "";
18-
assert_eq!(format!("{s:p}"), format!("{:p}", s.as_ptr()));
19-
assert_eq!(format!("{b:p}"), format!("{:p}", b.as_ptr()));
18+
assert_eq!(format!("{s:p}"), format!("{:p}", s as *const _));
19+
assert_eq!(format!("{b:p}"), format!("{:p}", b as *const _));
2020
}
2121

2222
#[test]

0 commit comments

Comments
 (0)