Skip to content

Commit

Permalink
avoid unsafe mem::transmute
Browse files Browse the repository at this point in the history
  • Loading branch information
getreu committed Dec 20, 2018
1 parent 0433c58 commit 2491f8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/codec/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl RawDecoder for AsciiGraphicDecoder {
output.writer_hint(input.len());

fn write_ascii_bytes(output: &mut dyn StringWriter, buf: &[u8]) {
output.write_str(unsafe { mem::transmute(buf) });
output.write_str(std::str::from_utf8(buf).unwrap());
}

// all non graphic is error
Expand Down

0 comments on commit 2491f8a

Please sign in to comment.