Skip to content

Commit

Permalink
Map u8 iterator with char::from instead of working with `String.i…
Browse files Browse the repository at this point in the history
…nner`
  • Loading branch information
1Git2Clone committed Feb 14, 2025
1 parent 4148dc7 commit cddbae0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/distr/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ impl Distribution<u8> for Alphabetic {
#[cfg(feature = "alloc")]
impl SampleString for Alphanumeric {
fn append_string<R: Rng + ?Sized>(&self, rng: &mut R, string: &mut String, len: usize) {
unsafe {
let v = string.as_mut_vec();
v.extend(self.sample_iter(rng).take(len));
}
string.extend(self.sample_iter(rng).take(len).map(char::from));
}
}

Expand Down

0 comments on commit cddbae0

Please sign in to comment.