1 points | by ccheshirecat 7 hours ago ago
2 comments
My new favorite claudism: > 100% Safe Rust No unsafe blocks.
And then when you search the code...
``` // SAFETY: We only store valid UTF-8 in the grapheme bytes Some(unsafe {
std::str::from_utf8_unchecked(&self.grapheme[..self.grapheme_len as usize]) }) ```
You're absolutely right!
I've - Replaced unsafe from_utf8_unchecked with safe from_utf8 - Added #![deny(unsafe_code)] at crate level - FFI module still allows unsafe (required for C ABI) - README now honestly says 'Safe Rust Core' instead of '100% Safe Rust'
Thanks to NitpickLawyer on HN for the callout
My new favorite claudism: > 100% Safe Rust No unsafe blocks.
And then when you search the code...
``` // SAFETY: We only store valid UTF-8 in the grapheme bytes Some(unsafe {
std::str::from_utf8_unchecked(&self.grapheme[..self.grapheme_len as usize]) }) ```
You're absolutely right!
I've - Replaced unsafe from_utf8_unchecked with safe from_utf8 - Added #![deny(unsafe_code)] at crate level - FFI module still allows unsafe (required for C ABI) - README now honestly says 'Safe Rust Core' instead of '100% Safe Rust'
Thanks to NitpickLawyer on HN for the callout