Skip to content

Commit 2491f53

Browse files
committed
Add lints and ensure doctests wrapped in functions are run
1 parent 96bc8de commit 2491f53

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@
4747
//! ```
4848
//! # use rand_core::{RngCore, SeedableRng};
4949
//! # use rand_mt::Mt64;
50-
//! # fn main() -> Result<(), rand_core::Error> {
50+
//! # fn example() -> Result<(), rand_core::Error> {
5151
//! // Create the RNG.
5252
//! let mut rng = Mt64::new(0x1234_567_89ab_cdef_u64);
5353
//! // start grabbing randomness from rng...
5454
//! let mut buf = vec![0; 512];
5555
//! rng.try_fill_bytes(&mut buf)?;
5656
//! # Ok(())
5757
//! # }
58+
//! # example().unwrap()
5859
//! ```
5960
//!
6061
//! Or if you want to use the default (fixed) seeds that are specified in the

src/mt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl RngCore for Mt19937GenRand32 {
220220
/// ```
221221
/// # use rand_core::RngCore;
222222
/// # use rand_mt::Mt19937GenRand32;
223-
/// # fn main() -> Result<(), rand_core::Error> {
223+
/// # fn example() -> Result<(), rand_core::Error> {
224224
/// let mut mt = Mt19937GenRand32::new_unseeded();
225225
/// let mut buf = [0; 32];
226226
/// mt.try_fill_bytes(&mut buf)?;
@@ -230,6 +230,7 @@ impl RngCore for Mt19937GenRand32 {
230230
/// assert_ne!([0; 31], buf);
231231
/// # Ok(())
232232
/// # }
233+
/// # example().unwrap()
233234
/// ```
234235
#[inline]
235236
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {

src/mt64.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl RngCore for Mt19937GenRand64 {
216216
/// ```
217217
/// # use rand_core::RngCore;
218218
/// # use rand_mt::Mt19937GenRand64;
219-
/// # fn main() -> Result<(), rand_core::Error> {
219+
/// # fn example() -> Result<(), rand_core::Error> {
220220
/// let mut mt = Mt19937GenRand64::new_unseeded();
221221
/// let mut buf = [0; 32];
222222
/// mt.try_fill_bytes(&mut buf)?;
@@ -226,6 +226,7 @@ impl RngCore for Mt19937GenRand64 {
226226
/// assert_ne!([0; 31], buf);
227227
/// # Ok(())
228228
/// # }
229+
/// # example().unwrap()
229230
/// ```
230231
#[inline]
231232
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {

0 commit comments

Comments
 (0)