Commit 8c57d1eae9

8c57d1eae96171994eed4f42e647d26f66218302

parent: 48b9fcb541

Unsigned

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

commands: Remove an unwrap from the devices command.

Layout: unified · split

src/commands/devices.rs +5 −3
@@ -74,12 +74,14 @@ impl DevicesCommand {
7474 match args.subcommand() {
7575 ("list", _) => Self::list(servers, buffer),
7676 ("delete", args) => {
77 let devices = args.unwrap().args.get("device-id").unwrap();
77 let devices = args
78 .and_then(|a| a.args.get("device-id"))
79 .expect("Args didn't contain any device ids");
7880 let devices: Vec<DeviceIdBox> = devices
7981 .vals
8082 .iter()
81 .filter_map(|d| {
82 d.clone().into_string().ok().map(|d| d.into())
83 .map(|d| {
84 d.clone().to_string_lossy().as_ref().into()
8385 })
8486 .collect();
8587 Self::delete(servers, buffer, devices);