fix most of the clippy linter warnings

This commit is contained in:
Henrik Friedrichsen
2019-04-23 22:28:05 +02:00
parent fe3470479c
commit 18c2f6466a
6 changed files with 30 additions and 28 deletions

View File

@@ -125,7 +125,7 @@ impl Layout {
}
fn get_current_screen(&self) -> Option<&Screen> {
if self.stack.len() > 0 {
if !self.stack.is_empty() {
return self.stack.last();
}
@@ -137,7 +137,7 @@ impl Layout {
}
fn get_current_screen_mut(&mut self) -> Option<&mut Screen> {
if self.stack.len() > 0 {
if !self.stack.is_empty() {
return self.stack.last_mut();
}
@@ -155,7 +155,7 @@ impl View for Layout {
let cmdline_visible = self.cmdline.get_content().len() > 0;
let mut cmdline_height = if cmdline_visible { 1 } else { 0 };
if result.as_ref().map(|o| o.is_some()).unwrap_or(true) {
if result.as_ref().map(Option::is_some).unwrap_or(true) {
cmdline_height += 1;
}
@@ -165,7 +165,7 @@ impl View for Layout {
let offset = HAlign::Center.get_offset(screen.title.width(), printer.size.x);
printer.print((offset, 0), &screen.title);
if self.stack.len() > 0 {
if !self.stack.is_empty() {
printer.print((1, 0), "<");
}
});
@@ -215,7 +215,7 @@ impl View for Layout {
let cmdline_visible = self.cmdline.get_content().len() > 0;
let mut cmdline_height = if cmdline_visible { 1 } else { 0 };
if result.as_ref().map(|o| o.is_some()).unwrap_or(true) {
if result.as_ref().map(Option::is_some).unwrap_or(true) {
cmdline_height += 1;
}

View File

@@ -354,7 +354,7 @@ impl<I: ListItem + Clone> ViewExt for ListView<I> {
if let Some(item) = content.get_mut(self.selected) {
let queue = self.queue.clone();
let library = self.library.clone();
let arg = args.get(0).map(|s| s.clone()).unwrap_or_default();
let arg = args.get(0).cloned().unwrap_or_default();
if arg == "album" {
if let Some(album) = item.album(queue.clone()) {