diff --git a/src/distr/other.rs b/src/distr/other.rs index 1b92d52c8b..8c53375497 100644 --- a/src/distr/other.rs +++ b/src/distr/other.rs @@ -172,10 +172,7 @@ impl Distribution for Alphabetic { #[cfg(feature = "alloc")] impl SampleString for Alphanumeric { fn append_string(&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)); } }