8000 Use `ArrayVec` to panic instead of resizing on overflow. · unicode-rs/unicode-normalization@485e9e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 485e9e7

Browse files
committed
Use ArrayVec to panic instead of resizing on overflow.
1 parent fea4f13 commit 485e9e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/replace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010
use core::fmt::{self, Write};
11-
use tinyvec::TinyVec;
11+
use tinyvec::ArrayVec;
1212

1313
/// External iterator for replacements for a string's characters.
1414
#[derive(Clone)]
@@ -36,7 +36,7 @@ impl<I: Iterator<Item = char>> Iterator for Replacements<I> {
3636
match self.iter.next() {
3737
Some(ch) => {
3838
// At this time, the longest replacement sequence has length 2.
39-
let mut buffer = TinyVec::<[char; 2]>::new();
39+
let mut buffer = ArrayVec::<[char; 2]>::new();
4040
super::char::decompose_cjk_compat_variants(ch, |d| buffer.push(d));
4141
self.buffer = buffer.get(1).copied();
4242
Some(buffer[0])

0 commit comments

Comments
 (0)
0