chore: cargo clippy --fix

This commit is contained in:
Henrik Friedrichsen
2025-04-11 10:09:03 +02:00
parent 4b3aaef2c7
commit 5d598e29bd
3 changed files with 6 additions and 6 deletions

View File

@@ -188,7 +188,7 @@ impl Queue {
pub fn remove(&self, index: usize) {
{
let mut q = self.queue.write().unwrap();
if q.len() == 0 {
if q.is_empty() {
info!("queue is empty");
return;
}
@@ -365,7 +365,7 @@ impl Queue {
if repeat == RepeatSetting::RepeatTrack && manual {
self.set_repeat(RepeatSetting::RepeatPlaylist);
}
} else if repeat == RepeatSetting::RepeatPlaylist && q.len() > 0 {
} else if repeat == RepeatSetting::RepeatPlaylist && !q.is_empty() {
let random_order = self.random_order.read().unwrap();
self.play(
random_order.as_ref().map(|o| o[0]).unwrap_or(0),
@@ -385,7 +385,7 @@ impl Queue {
if let Some(index) = self.previous_index() {
self.play(index, false, false);
} else if repeat == RepeatSetting::RepeatPlaylist && q.len() > 0 {
} else if repeat == RepeatSetting::RepeatPlaylist && !q.is_empty() {
if self.get_shuffle() {
let random_order = self.random_order.read().unwrap();
self.play(

View File

@@ -267,7 +267,7 @@ impl View for Layout {
fn draw(&self, printer: &Printer<'_, '_>) {
let result = self.get_result();
let cmdline_visible = self.cmdline.get_content().len() > 0;
let cmdline_visible = !self.cmdline.get_content().is_empty();
let mut cmdline_height = usize::from(cmdline_visible);
if result.as_ref().map(Option::is_some).unwrap_or(true) {
cmdline_height += 1;
@@ -411,7 +411,7 @@ impl View for Layout {
let result = self.get_result();
let cmdline_visible = self.cmdline.get_content().len() > 0;
let cmdline_visible = !self.cmdline.get_content().is_empty();
let mut cmdline_height = usize::from(cmdline_visible);
if result.as_ref().map(Option::is_some).unwrap_or(true) {
cmdline_height += 1;

View File

@@ -45,7 +45,7 @@ pub fn ms_to_hms(duration: u32) -> String {
pub fn cache_path_for_url(url: String) -> std::path::PathBuf {
let mut path = crate::config::cache_path("covers");
path.push(url.split('/').last().unwrap());
path.push(url.split('/').next_back().unwrap());
path
}