Skip to content

Commit

Permalink
Remove redundant unsafe block
Browse files Browse the repository at this point in the history
  • Loading branch information
PJB3005 committed Oct 2, 2024
1 parent 8947cf2 commit fe965c8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,12 @@ pub unsafe fn string_view_into_str<'a>(string_view: native::WGPUStringView) -> O
_ => panic!("Null address to WGPUStringView!"),
}
} else {
unsafe {
let bytes = match string_view.length {
crate::conv::WGPU_STRLEN => CStr::from_ptr(string_view.data).to_bytes(),
_ => make_slice(string_view.data as *const u8, string_view.length),
};
let bytes = match string_view.length {
crate::conv::WGPU_STRLEN => CStr::from_ptr(string_view.data).to_bytes(),
_ => make_slice(string_view.data as *const u8, string_view.length),
};

Some(std::str::from_utf8_unchecked(bytes))
}
Some(std::str::from_utf8_unchecked(bytes))
}
}

Expand Down

0 comments on commit fe965c8

Please sign in to comment.