Skip to content

Commit

Permalink
remove unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshix-1 committed May 26, 2024
1 parent 5ef2ba9 commit 74399d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/language/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ impl StringChunkIter {
) -> Self {
Self {
word_length,
padded_word_byte_count: if padded_word_byte_count == 0 {
NonZeroUsize::MIN
padded_word_byte_count: if let Some(non_zero) = NonZeroUsize::new(padded_word_byte_count) {
non_zero
} else {
unsafe { NonZeroUsize::new_unchecked(padded_word_byte_count) }
NonZeroUsize::MIN
},
index: if string.is_empty() { usize::MAX } else { 0 },
is_ascii: word_length == padded_word_byte_count,
Expand Down

0 comments on commit 74399d9

Please sign in to comment.