Skip to content

Commit a4ceb23

Browse files
committed
Fix failing repr test
It was comparing the pointers, not the levels themselves. This also changes transmute to explicitly specify both types to make this easier to debug in the future.
1 parent 87873af commit a4ceb23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tracing-core/src/metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,13 @@ mod tests {
858858
(LevelFilter::DEBUG, LevelInner::Debug as usize),
859859
(LevelFilter::TRACE, LevelInner::Trace as usize),
860860
];
861-
for &(ref filter, expected) in &mapping {
861+
for &(filter, expected) in &mapping {
862862
let repr = unsafe {
863863
// safety: The entire purpose of this test is to assert that the
864864
// actual repr matches what we expect it to be --- we're testing
865865
// that *other* unsafe code is sound using the transmuted value.
866866
// We're not going to do anything with it that might be unsound.
867-
mem::transmute::<_, usize>(filter)
867+
mem::transmute::<LevelFilter, usize>(filter)
868868
};
869869
assert_eq!(expected, repr, "repr changed for {:?}", filter)
870870
}

0 commit comments

Comments
 (0)