Skip to content

Commit

Permalink
refactor: fix a few pedantic clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeStanger committed May 4, 2023
1 parent 7f46cb4 commit 38da59c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/clients/music/mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use color_eyre::Result;
use lazy_static::lazy_static;
use mpris::{DBusError, Event, Metadata, PlaybackStatus, Player, PlayerFinder};
use std::collections::HashSet;
use std::string;
use std::sync::{Arc, Mutex};
use std::thread::sleep;
use std::time::Duration;
Expand Down Expand Up @@ -259,7 +260,7 @@ impl From<Metadata> for Track {
.and_then(mpris::MetadataValue::as_str_array)
.and_then(|arr| arr.first().map(|val| (*val).to_string())),
track: value.track_number().map(|track| track as u64),
cover_path: value.art_url().map(|s| s.to_string()),
cover_path: value.art_url().map(string::ToString::to_string),
}
}
}
Expand Down
21 changes: 10 additions & 11 deletions src/config/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ pub enum TransitionType {
}

impl TransitionType {
pub fn to_revealer_transition_type(&self, orientation: Orientation) -> RevealerTransitionType {
pub const fn to_revealer_transition_type(
&self,
orientation: Orientation,
) -> RevealerTransitionType {
match (self, orientation) {
(TransitionType::SlideStart, Orientation::Horizontal) => {
RevealerTransitionType::SlideLeft
}
(TransitionType::SlideStart, Orientation::Vertical) => RevealerTransitionType::SlideUp,
(TransitionType::SlideEnd, Orientation::Horizontal) => {
RevealerTransitionType::SlideRight
}
(TransitionType::SlideEnd, Orientation::Vertical) => RevealerTransitionType::SlideDown,
(TransitionType::Crossfade, _) => RevealerTransitionType::Crossfade,
(Self::SlideStart, Orientation::Horizontal) => RevealerTransitionType::SlideLeft,
(Self::SlideStart, Orientation::Vertical) => RevealerTransitionType::SlideUp,
(Self::SlideEnd, Orientation::Horizontal) => RevealerTransitionType::SlideRight,
(Self::SlideEnd, Orientation::Vertical) => RevealerTransitionType::SlideDown,
(Self::Crossfade, _) => RevealerTransitionType::Crossfade,
_ => RevealerTransitionType::None,
}
}
Expand Down Expand Up @@ -152,7 +151,7 @@ impl CommonConfig {

revealer.connect_child_revealed_notify(move |revealer| {
if !revealer.reveals_child() {
container.hide()
container.hide();
}
});
},
Expand Down
7 changes: 3 additions & 4 deletions src/desktop_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ pub fn find_desktop_file(app_id: &str) -> Option<PathBuf> {
for dir in dirs {
let mut walker = WalkDir::new(dir).max_depth(5).into_iter();

let entry = walker.find(|entry| match entry {
Ok(entry) => {
let entry = walker.find(|entry| {
entry.as_ref().map_or(false, |entry| {
let file_name = entry.file_name().to_string_lossy().to_lowercase();
let test_name = format!("{}.desktop", app_id.to_lowercase());
file_name == test_name
}
_ => false,
})
});

if let Some(Ok(entry)) = entry {
Expand Down
2 changes: 1 addition & 1 deletion src/dynamic_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl DynamicString {
if let OutputStream::Stdout(out) = out {
let mut label_parts = lock!(label_parts);

let _ = std::mem::replace(&mut label_parts[i], out);
let _: String = std::mem::replace(&mut label_parts[i], out);

let string = label_parts.join("");
send!(tx, string);
Expand Down

0 comments on commit 38da59c

Please sign in to comment.