Commit 9a149eea78

9a149eea782cc2d6b2a3f8c9ecf1763164d7081f

parent: 5f21ff5a1f

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2020-10-18 09:05 UTC

commands: Fix a lint issue.

Layout: unified · split

src/commands/keys.rs +8 −3
@@ -19,7 +19,7 @@ pub struct KeysCommand {
1919
2020impl KeysCommand {
2121 pub const DESCRIPTION: &'static str = "Import or export E2EE keys.";
22 pub const COMPLETION: &'static str = "import|export %(filename)";
22 pub const COMPLETION: &'static str = "import|export %(filename)";
2323
2424 pub fn create(servers: &Servers) -> Result<Command, ()> {
2525 let settings = CommandSettings::new("keys")
@@ -45,12 +45,17 @@ impl KeysCommand {
4545 let passphrase = args
4646 .args
4747 .get("passphrase")
48 .map(|p| p.vals.iter().next().map(|p| p.clone().into_string().ok()))
48 .map(|p| p.vals.get(0).map(|p| p.clone().into_string().ok()))
4949 .flatten()
5050 .flatten()
5151 .expect("No passphrase found");
5252
53 let file = args.args.get("file").unwrap().vals.iter().next().unwrap();
53 let file = args
54 .args
55 .get("file")
56 .map(|f| f.vals.get(0))
57 .flatten()
58 .expect("No file found");
5459 let file = Weechat::expand_home(&file.to_string_lossy());
5560 let file = PathBuf::from(file);
5661 (file, passphrase)