Replace rand with fastrand (#600)

We don't need cryptographically secure random numbers, this simplifies
the dependency tree and speeds up builds.
This commit is contained in:
Alex Wennerberg
2021-04-06 12:32:43 -07:00
committed by GitHub
parent 61b08814c9
commit 53bfb65423
2 changed files with 5 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ use crate::message::{
EmailFormat, IntoBody,
};
use mime::Mime;
use rand::Rng;
use std::iter::repeat_with;
/// MIME part variants
#[derive(Debug, Clone)]
@@ -168,12 +168,9 @@ pub enum MultiPartKind {
}
/// Create a random MIME boundary.
/// (Not cryptographically random)
fn make_boundary() -> String {
rand::thread_rng()
.sample_iter(rand::distributions::Alphanumeric)
.take(40)
.map(char::from)
.collect()
repeat_with(fastrand::alphanumeric).take(40).collect()
}
impl MultiPartKind {