Apply cargo clippy suggestions

This commit is contained in:
Henrik Friedrichsen
2022-07-31 11:32:59 +02:00
parent 249a4ef5a7
commit 1e135de443
4 changed files with 7 additions and 18 deletions

View File

@@ -152,11 +152,7 @@ pub fn write_share(url: String) -> Option<()> {
)
.ok()
}
if let Some(o) = option {
Some(o)
} else {
None
}
option
} else {
//use x11 clipboard
ClipboardProvider::new()
@@ -182,11 +178,7 @@ pub fn write_share(url: String) -> Option<()> {
)
.ok()
}
if let Some(o) = option {
Some(o)
} else {
None
}
option
} else {
//use x11 clipboard
ClipboardProvider::new()

View File

@@ -210,7 +210,7 @@ impl ContextMenu {
let dialog = Dialog::new()
.title(format!(
"Select action for artist: {}",
artist.clone().name.as_str()
artist.name.as_str()
))
.dismiss_button("Cancel")
.padding(Margins::lrtb(1, 1, 1, 0))

View File

@@ -62,12 +62,7 @@ impl LibraryView {
Self {
tabs: tabview,
display_name: {
let hide_username = library
.cfg
.values()
.hide_display_names
.clone()
.unwrap_or(false);
let hide_username = library.cfg.values().hide_display_names.unwrap_or(false);
if hide_username {
None
} else {

View File

@@ -1,5 +1,7 @@
#![allow(dead_code)]
use std::fmt::Write;
/// Returns a human readable String of a Duration
///
/// Example: `3h 12m 53s`
@@ -7,7 +9,7 @@ pub fn format_duration(d: &std::time::Duration) -> String {
let mut s = String::new();
let mut append_unit = |value, unit| {
if value > 0 {
s.push_str(&format!("{}{}", value, unit));
let _ = write!(s, "{}{}", value, unit);
}
};