From 9d253d84f72d6af12967d248b98f44f9c44e7790 Mon Sep 17 00:00:00 2001 From: TAKAMI Torao Date: Thu, 19 May 2022 18:48:15 +0900 Subject: [PATCH] migrate the project to 2021 edition --- Cargo.toml | 4 ++-- README.md | 1 + src/lib.rs | 14 ++------------ 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b53393a..512538f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "tinymt" -version = "1.0.6" +version = "1.0.7" authors = ["Torao Takami "] -edition = "2018" +edition = "2021" repository = "https://github.com/torao/tinymt" keywords = ["prng", "mersennetwister", "mt", "tinymt", "random"] license = "MIT" diff --git a/README.md b/README.md index 0ee7ea2..f2b2435 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ $ cargo +nightly fmt # or fmt -- --check ## History +* 2022-05-19 (v1.0.7) Migrate the project to 2021 edition. * 2021-06-12 (v1.0.6) Upgrade `rand` to 0.8. ## Licenses diff --git a/src/lib.rs b/src/lib.rs index f5900bc..2a9f06b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,7 @@ use rand::{Error, RngCore, SeedableRng}; pub mod tinymt32; pub mod tinymt64; +#[derive(Default)] pub struct TinyMT64Seed(pub [u8; 8]); impl From for TinyMT64Seed { @@ -19,12 +20,6 @@ impl From for u64 { } } -impl Default for TinyMT64Seed { - fn default() -> TinyMT64Seed { - TinyMT64Seed([0; 8]) - } -} - impl AsMut<[u8]> for TinyMT64Seed { fn as_mut(&mut self) -> &mut [u8] { &mut self.0 @@ -84,6 +79,7 @@ impl RngCore for TinyMT64 { } } +#[derive(Default)] pub struct TinyMT32Seed(pub [u8; 4]); impl From for TinyMT32Seed { @@ -98,12 +94,6 @@ impl From for u32 { } } -impl Default for TinyMT32Seed { - fn default() -> TinyMT32Seed { - TinyMT32Seed([0; 4]) - } -} - impl AsMut<[u8]> for TinyMT32Seed { fn as_mut(&mut self) -> &mut [u8] { &mut self.0