rusty-diceware

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a1d292a211af93d9450821f8ef13b31f8e6232dd
parent 765107c10399b2f9f541eb783e77655222de9dbd
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Sun, 12 May 2019 18:27:32 +0300

Remove uneeded `cfg` pragma, as they hide errors, also fix those errors.

Diffstat:
Msrc/diceware.rs | 9+++------
Msrc/main.rs | 2--
Msrc/tests.rs | 4+++-
3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/diceware.rs b/src/diceware.rs @@ -15,9 +15,8 @@ pub struct ReinholdWord(&'static str); pub struct MiniLockWord(&'static str); impl BealeWord { - #[cfg(test)] pub fn new(word: &'static str) -> BealeWord { - BealeWord(word.clone()) + BealeWord(word) } pub fn entropy() -> f64 { @@ -30,9 +29,8 @@ impl BealeWord { } impl ReinholdWord { - #[cfg(test)] pub fn new(word: &'static str) -> ReinholdWord { - ReinholdWord(word.clone()) + ReinholdWord(word) } pub fn entropy() -> f64 { @@ -45,9 +43,8 @@ impl ReinholdWord { } impl MiniLockWord { - #[cfg(test)] pub fn new(word: &'static str) -> MiniLockWord { - MiniLockWord(word.clone()) + MiniLockWord(word) } pub fn entropy() -> f64 { diff --git a/src/main.rs b/src/main.rs @@ -1,6 +1,5 @@ mod diceware; -#[cfg(test)] mod tests; extern crate getopts; @@ -31,7 +30,6 @@ fn print_usage(program: &str, opts: Options) { print!("{}", opts.usage(&brief)); } -#[cfg(not(test))] fn main() { let args: Vec<String> = std::env::args().collect(); let program = &args[0]; diff --git a/src/tests.rs b/src/tests.rs @@ -1,6 +1,8 @@ extern crate rand; -use rand::{Rng, SeedableRng, StdRng}; +use rand::rngs::StdRng; +use rand::Rng; +use rand::SeedableRng; use crate::diceware::{BealeWord, ReinholdWord};