Reduce cargo clippy warnings

This commit is contained in:
Kenny Levinsen
2020-04-22 01:31:22 +02:00
parent 300711affe
commit 319bcdd355
17 changed files with 168 additions and 188 deletions
+4 -4
View File
@@ -4,8 +4,8 @@ use crate::widgets::bar_widget::{BarWidget, BarWidgetImpl};
use alsa::mixer::{Mixer, Selem, SelemChannelId, SelemId};
const CARD_NAME: &'static str = "default";
const SELEM_NAME: &'static str = "Master";
const CARD_NAME: &str = "default";
const SELEM_NAME: &str = "Master";
const SELEM_ID: u32 = 0u32;
#[inline]
@@ -15,8 +15,8 @@ fn alsa_error_to_io_error(fail: &'static str, err: &alsa::Error) -> ::std::io::E
let errno = err
.errno()
.map(|errno| format!("; errno = {}", errno))
.unwrap_or(String::new());
return ::std::io::Error::new(kind, format!("{}: {}{}", fail, func, errno));
.unwrap_or_default();
::std::io::Error::new(kind, format!("{}: {}{}", fail, func, errno))
}
#[inline]
+5 -9
View File
@@ -158,7 +158,7 @@ impl PulseAudioClient {
match req {
PulseAudioClientRequest::GetDefaultDevice(s) => {
introspector.get_server_info(move |info| {
let _res = PulseAudioClient::server_info_callback(
PulseAudioClient::server_info_callback(
cl.clone(),
l.clone(),
info,
@@ -260,13 +260,12 @@ impl PulseAudioClient {
}
fn send(&self, request: PulseAudioClientRequest) -> Result<(), ::std::io::Error> {
let res = self.sender.send(request).map_err(|_e| {
self.sender.send(request).map_err(|_e| {
::std::io::Error::new(
::std::io::ErrorKind::Other,
"unable to send pulseaudio request",
)
});
res
})
}
fn server_info_callback<F>(s: Arc<Mutex<Self>>, listener: F, server_info: &ServerInfo)
@@ -371,10 +370,7 @@ impl PulseAudioSoundDevice {
cl.default_sink.to_string()
};
(*inner.lock().unwrap()).name = Some(name.clone());
let device = PulseAudioSoundDevice {
client: cl,
inner: inner,
};
let device = PulseAudioSoundDevice { client: cl, inner };
let (tx, rx) = channel();
{
let cl = client.lock().unwrap();
@@ -497,7 +493,7 @@ impl PulseAudio {
*dirty.lock().unwrap() = true;
sender.send(Cmd::Draw).unwrap();
})?;
Ok(Box::new(PulseAudio { device: device }))
Ok(Box::new(PulseAudio { device }))
})
}
}