cargo clippy
This commit is contained in:
@@ -397,26 +397,22 @@ pub fn parse(input: &str) -> Option<Command> {
|
|||||||
"added" => Some(SortKey::Added),
|
"added" => Some(SortKey::Added),
|
||||||
"artist" => Some(SortKey::Artist),
|
"artist" => Some(SortKey::Artist),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
})?;
|
||||||
|
|
||||||
if sort_key.is_none() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let sort_direction = args
|
let sort_direction = args
|
||||||
.get(1)
|
.get(1)
|
||||||
.and_then(|direction| match *direction {
|
.map(|direction| match *direction {
|
||||||
"a" => Some(SortDirection::Ascending),
|
"a" => SortDirection::Ascending,
|
||||||
"asc" => Some(SortDirection::Ascending),
|
"asc" => SortDirection::Ascending,
|
||||||
"ascending" => Some(SortDirection::Ascending),
|
"ascending" => SortDirection::Ascending,
|
||||||
"d" => Some(SortDirection::Descending),
|
"d" => SortDirection::Descending,
|
||||||
"desc" => Some(SortDirection::Descending),
|
"desc" => SortDirection::Descending,
|
||||||
"descending" => Some(SortDirection::Descending),
|
"descending" => SortDirection::Descending,
|
||||||
_ => Some(SortDirection::Ascending),
|
_ => SortDirection::Ascending,
|
||||||
})
|
})
|
||||||
.unwrap_or(SortDirection::Ascending);
|
.unwrap_or(SortDirection::Ascending);
|
||||||
|
|
||||||
Some(Command::Sort(sort_key.unwrap(), sort_direction))
|
Some(Command::Sort(sort_key, sort_direction))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ impl ContextMenu {
|
|||||||
true => "Unsave track",
|
true => "Unsave track",
|
||||||
false => "Save track",
|
false => "Save track",
|
||||||
},
|
},
|
||||||
ContextMenuAction::ToggleTrackSavedStatus(Box::new(t.clone())),
|
ContextMenuAction::ToggleTrackSavedStatus(Box::new(t)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ impl ViewExt for PlaylistView {
|
|||||||
|
|
||||||
if let Command::Sort(key, direction) = cmd {
|
if let Command::Sort(key, direction) = cmd {
|
||||||
self.list.sort(key, direction);
|
self.list.sort(key, direction);
|
||||||
return Ok(CommandResult::Consumed(None))
|
return Ok(CommandResult::Consumed(None));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.list.on_command(s, cmd)
|
self.list.on_command(s, cmd)
|
||||||
|
|||||||
Reference in New Issue
Block a user