Skip to content

Commit 0bc783a

Browse files
Remove unsafe code
1 parent 7001945 commit 0bc783a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/event/data.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ impl fmt::Display for Data {
9191
Err(e) => {
9292
let (good, bad) = slice.split_at(e.valid_up_to());
9393

94-
// SAFETY: good is a valid utf8 sequency
95-
f.write_str(unsafe { str::from_utf8_unchecked(good) })?;
96-
94+
f.write_str(str::from_utf8(good).unwrap())?;
9795
write!(f, "\\x{:02X}", bad[0])?;
9896
slice = &bad[1..];
9997
}

0 commit comments

Comments
 (0)