Skip to content

Commit f93c2e1

Browse files
author
Rémi Lauzier
committed
Update rand and fix some clippy warnings
1 parent 0e4430e commit f93c2e1

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["sfx","sound","effect"]
1313
categories = ["multimedia::audio"]
1414

1515
[dependencies]
16-
rand = "0.6"
16+
rand = { version = "0.8", features = ["small_rng"]}
1717

1818
[dev-dependencies]
1919
sdl2 = "0.34.5" # SDL2 bindings for Rust

examples/cpal.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use cpal::traits::{EventLoopTrait, HostTrait};
22
use rand::rngs::SmallRng;
3-
use rand::{FromEntropy, RngCore};
3+
use rand::RngCore;
4+
use rand::SeedableRng;
45
use std::time::Duration;
56
use std::{
67
sync::{Arc, Mutex},
@@ -12,6 +13,7 @@ pub struct Audio {
1213
generator: Arc<Mutex<Option<sfxr::Generator>>>,
1314
}
1415

16+
#[allow(clippy::new_without_default)]
1517
impl Audio {
1618
/// Instantiate a new audio object without a generator.
1719
pub fn new() -> Self {
@@ -58,7 +60,7 @@ impl Audio {
5860
let stream_data = match stream_result {
5961
Ok(data) => data,
6062
Err(err) => {
61-
eprintln!("an error occurred on stream {:?}: {}", stream_id, err);
63+
eprintln!("an error occurred on stream {:?}: {:?}", stream_id, err);
6264
return;
6365
}
6466
};

examples/simple.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rand::rngs::SmallRng;
2-
use rand::{FromEntropy, RngCore};
2+
use rand::RngCore;
3+
use rand::SeedableRng;
34
use sdl2::audio::{AudioCallback, AudioSpecDesired};
45
use std::time::Duration;
56

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
rust_2018_idioms,
4141
future_incompatible,
4242
nonstandard_style,
43-
unused
43+
unused,
44+
clippy::all
4445
)]
4546

4647
use rand::rngs::SmallRng;
@@ -110,6 +111,7 @@ pub struct Sample {
110111
pub arp_mod: f64,
111112
}
112113

114+
#[allow(clippy::new_without_default)]
113115
impl Sample {
114116
/// Constructs a new Sample with default settings
115117
pub fn new() -> Sample {

0 commit comments

Comments
 (0)