Skip to content

Commit

Permalink
Use str::from_utf8 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz committed Sep 12, 2019
1 parent ed70617 commit a90a530
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/run-pass/aligned_utf8_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
let mut y: Vec<u8> = unsafe { std::mem::transmute(x) };
unsafe { y.set_len(2 * N) };

println!("{:?}", String::from_utf8_lossy(&y));
println!("{:?}", std::str::from_utf8(&y).unwrap());

let mut x: Vec<u16> = unsafe { std::mem::transmute(y) };
unsafe { x.set_len(N) };
Expand Down

0 comments on commit a90a530

Please sign in to comment.