diff options
| author | Fuwn <[email protected]> | 2021-06-02 02:24:21 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-06-02 02:24:21 +0000 |
| commit | ec25ec71107d9a658458d9cf12b950af7b49bb59 (patch) | |
| tree | cbb103118e4f712872e23564c39a7e97635966db /src | |
| parent | fix(readme): inline code for path (diff) | |
| download | nitrous-ec25ec71107d9a658458d9cf12b950af7b49bb59.tar.xz nitrous-ec25ec71107d9a658458d9cf12b950af7b49bb59.zip | |
refactor(clippy): strictor clippy constraints
Diffstat (limited to 'src')
| -rw-r--r-- | src/cli.rs | 13 | ||||
| -rw-r--r-- | src/main.rs | 17 | ||||
| -rw-r--r-- | src/nitrous.rs | 4 |
3 files changed, 22 insertions, 12 deletions
@@ -13,10 +13,7 @@ impl Cli { pub async fn execute() { let matches = Self::cli().get_matches(); - let mut debug = false; - if matches.is_present("debug") { - debug = true; - } + let debug = matches.is_present("debug"); if matches.is_present("generate") { Nitrous::generate( @@ -39,12 +36,10 @@ impl Cli { .value_of("file"); if argument.is_some() { argument.unwrap() + } else if std::fs::File::open("nitrous/codes.txt").is_err() { + panic!("cannot open nitrous generated codes.txt"); } else { - if std::fs::File::open("nitrous/codes.txt").is_err() { - panic!("cannot open nitrous generated codes.txt"); - } else { - "nitrous/codes.txt" - } + "nitrous/codes.txt" } }, debug, diff --git a/src/main.rs b/src/main.rs index 37c0fcc..cec62f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,22 @@ // Copyleft (ɔ) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only -#![warn(rust_2018_idioms)] +#![feature( + type_ascription, + hash_set_entry, + type_name_of_val, + decl_macro, + proc_macro_hygiene +)] +#![deny( + warnings, + nonstandard_style, + unused, + future_incompatible, + rust_2018_idioms, + unsafe_code +)] +#![deny(clippy::all, clippy::nursery, clippy::pedantic)] #![recursion_limit = "128"] #[macro_use] diff --git a/src/nitrous.rs b/src/nitrous.rs index 900964e..9459eb4 100644 --- a/src/nitrous.rs +++ b/src/nitrous.rs @@ -22,7 +22,7 @@ impl Nitrous { crate::cli::Cli::execute().await; } - fn initialize() { let _ = create_dir("nitrous"); } + fn initialize() { create_dir("nitrous").unwrap(); } pub fn generate(amount: usize, debug: bool) { Self::initialize(); @@ -46,7 +46,7 @@ impl Nitrous { pub async fn check(codes_file_name: &str, debug: bool) { Self::initialize(); - let _ = create_dir("nitrous/check/"); + create_dir("nitrous/check/").unwrap(); let codes = File::open(codes_file_name).unwrap(); let mut invalid = File::create("nitrous/check/invalid.txt").unwrap(); let mut valid = File::create("nitrous/check/valid.txt").unwrap(); |