From 3a264462406ce556df0fac41b4024eb2ee5c6676 Mon Sep 17 00:00:00 2001 From: michal Date: Sat, 22 Jan 2022 20:48:18 +0000 Subject: [PATCH] got clippy to shut up --- src/main.rs | 2 +- src/repository/config.rs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8571d07..036770f 100755 --- a/src/main.rs +++ b/src/main.rs @@ -201,7 +201,7 @@ fn main() { if !Path::exists("mlc.toml".as_ref()) { create_config(); } - let editor = env::var("EDITOR").unwrap_or("nano".to_string()); + let editor = env::var("EDITOR").unwrap_or_else(|_| "nano".to_string()); Command::new(editor) .arg("mlc.toml") .spawn() diff --git a/src/repository/config.rs b/src/repository/config.rs index 5b8d91a..0932c22 100644 --- a/src/repository/config.rs +++ b/src/repository/config.rs @@ -4,14 +4,12 @@ use std::io::Write; use std::path::Path; use crate::crash; -const DEFAULT_CONFIG: &str = r#" -mode = "" # either "repository" or "workspace" +const DEFAULT_CONFIG: &str = r#"mode = "" # either "repository" or "workspace" name = "" # only required when in repository mode, decides what to call the repository and relevant files -repo = [""] # an array of git repos to clone from -"#; +repo = [""] # an array of git repos to clone from"#; pub fn create_config() { - if !env::current_dir().unwrap().read_dir().unwrap().next().is_none() { + if env::current_dir().unwrap().read_dir().unwrap().next().is_some() { crash("Directory is not empty, please only create a repository in an empty directory".to_string(), 6); } if !Path::exists("mlc.toml".as_ref()) {