mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Fix clippy warnings in components/rand
(#31549)
* resolved clippy warnings in components/rand Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * replaced new() with default() Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * replaced ServoRng::new() with ServoRng::default() Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * moved the contents of the new() method into the default() method Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> --------- Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> Co-authored-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>
This commit is contained in:
parent
e4ac047a9c
commit
64d013d473
4 changed files with 6 additions and 6 deletions
|
@ -95,12 +95,12 @@ impl ServoRng {
|
|||
}
|
||||
}
|
||||
|
||||
impl ServoRng {
|
||||
impl Default for ServoRng {
|
||||
/// Create an auto-reseeding instance of `ServoRng`.
|
||||
///
|
||||
/// This uses the shared `OsRng`, so avoids consuming
|
||||
/// a file descriptor.
|
||||
pub fn new() -> ServoRng {
|
||||
fn default() -> Self {
|
||||
trace!("Creating new ServoRng.");
|
||||
let mut os_rng = OS_RNG.lock().expect("Poisoned lock.");
|
||||
let isaac_rng = IsaacCore::from_rng(&mut *os_rng).unwrap();
|
||||
|
@ -156,7 +156,7 @@ pub fn thread_rng() -> ServoThreadRng {
|
|||
}
|
||||
|
||||
thread_local! {
|
||||
static SERVO_THREAD_RNG: ServoThreadRng = ServoThreadRng { rng: Rc::new(RefCell::new(ServoRng::new())) };
|
||||
static SERVO_THREAD_RNG: ServoThreadRng = ServoThreadRng { rng: Rc::new(RefCell::new(ServoRng::default())) };
|
||||
}
|
||||
|
||||
impl RngCore for ServoThreadRng {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue