Calm down clippy

This commit is contained in:
Ryze 2023-03-10 06:04:40 +03:00
parent 674e3b77ed
commit d104354966
Signed by: ryze
GPG key ID: 9B296C5CEAEAAAC1
6 changed files with 10 additions and 14 deletions

View file

@ -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);
}
}
@ -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);
}
}

View file

@ -22,5 +22,5 @@ fn mpv_open_cplugin(handle: *mut mpv_handle) -> std::os::raw::c_int {
};
plugin.run();
return 0;
0
}

View file

@ -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}");
}
}
}

View file

@ -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)
}
@ -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> {

View file

@ -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>;
}

View file

@ -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}");