diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-05 11:20:17 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-05 11:20:17 -0400 |
commit | babf6e62b0f6fea99cedd5680b057437beb9251e (patch) | |
tree | cbc36226fc425fa1de328a95e6919af2f39ea83e /src/commands/mod.rs | |
parent | a31f9714f81f8801b803356ff467d4a7ad78e34d (diff) |
fmt, clippy and make more fields private
Diffstat (limited to 'src/commands/mod.rs')
-rw-r--r-- | src/commands/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index e8d165f..93606d3 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -75,7 +75,7 @@ pub struct ProgressInfo { pub total_bytes: u64, } -pub fn from_args(command: &str, args: &Vec<&str>) -> Result<Box<JoshutoCommand>, KeymapError> { +pub fn from_args(command: &str, args: &[&str]) -> Result<Box<JoshutoCommand>, KeymapError> { match command { "cd" => match args.len() { 0 => match HOME_DIR.as_ref() { @@ -140,13 +140,13 @@ pub fn from_args(command: &str, args: &Vec<&str>) -> Result<Box<JoshutoCommand>, "delete_files" => Ok(Box::new(self::DeleteFiles::new())), "force_quit" => Ok(Box::new(self::ForceQuit::new())), "mkdir" => { - if args.len() == 0 { + if args.is_empty() { Err(KeymapError::new( Some("mkdir"), String::from("mkdir requires additional parameter"), )) } else { - let paths: Vec<PathBuf> = args.iter().map(|s| PathBuf::from(s)).collect(); + let paths: Vec<PathBuf> = args.iter().map(PathBuf::from).collect(); Ok(Box::new(self::NewDirectory::new(paths))) } } |