Skip to content

Commit

Permalink
Calm down clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ryze312 committed Mar 10, 2023
1 parent 674e3b7 commit d104354
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/discord_client/music_brainz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn get_track_cover_art(artist: &Option<String>, title: &Option<String>) -> Optio
if let Some(ref artist) = artist {
// Some artist fields might contain + characters
// Pointing at multiple artists
for part in artist.split("+") {
for part in artist.split('+') {
builder.and().artist(part);
}
}
Expand All @@ -33,7 +33,7 @@ fn get_album_cover_art(album_artist: &Option<String>, album: &Option<String>) -
if let Some(ref album_artist) = album_artist {
// Some artist fields might contain + characters
// Pointing at multiple artists
for part in album_artist.split("+") {
for part in album_artist.split('+') {
builder.and().artist(part);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ fn mpv_open_cplugin(handle: *mut mpv_handle) -> std::os::raw::c_int {
};

plugin.run();
return 0;
0
}
6 changes: 3 additions & 3 deletions src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ impl Logger {

pub fn info(&self, message: &str) {
if self.log_level >= LogLevel::Info {
println!("[mpv-rpc (INFO)] {}", message);
println!("[mpv-rpc (INFO)] {message}");
}
}

pub fn warning(&self, message: &str) {
if self.log_level >= LogLevel::Warn {
println!("[mpv-rpc (WARN)] {}", message);
println!("[mpv-rpc (WARN)] {message}");
}
}

pub fn error(&self, message: &str) {
if self.log_level >= LogLevel::Error {
println!("[mpv-rpc (ERROR)] {}", message);
println!("[mpv-rpc (ERROR)] {message}");
}
}
}
5 changes: 2 additions & 3 deletions src/mpv_event_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl MpvEventQueue {
Ok(new_self)
}

pub fn from_ptr<'a>(handle: *mut mpv_handle, logger: Rc<Logger>) -> Result<Self, &'static str> {
pub fn from_ptr(handle: *mut mpv_handle, logger: Rc<Logger>) -> Result<Self, &'static str> {
MpvEventQueue::new(Handle::from_ptr(handle), logger)
}

Expand All @@ -42,8 +42,7 @@ impl MpvEventQueue {

pub fn next_event(&mut self) -> Option<MpvEvent> {
let event = self.mpv.wait_event(-1.0);
let mpv_event = self.convert_event(event);
mpv_event
self.convert_event(event)
}

pub fn handle_request(&self, request: MpvRequest) -> Result<(), &'static str> {
Expand Down
2 changes: 1 addition & 1 deletion src/mpv_event_queue/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ pub trait MpvEventHandler {
}

pub trait MpvRequester {
fn next_request<'a>(&mut self) -> Option<MpvRequest>;
fn next_request(&mut self) -> Option<MpvRequest>;
}
5 changes: 1 addition & 4 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ impl RPCPlugin {
}

fn handle_event(&mut self, event: MpvEvent) -> bool {
let exit = match event {
MpvEvent::Exit => true,
_ => false
};
let exit = matches!(event, MpvEvent::Exit);

if let Err(e) = self.discord.handle_event(event) {
logging::error!(self.logger, "Failed to handle event: {e}");
Expand Down

0 comments on commit d104354

Please sign in to comment.