Use format string with panic
This commit is contained in:
+1
-1
@@ -345,6 +345,6 @@ impl Default for Config {
|
||||
fn get_font<'a>(name: &str, map: &'a FontMap) -> FontRef<'a> {
|
||||
match map.get(name) {
|
||||
Some(f) => f,
|
||||
None => panic!(format!("Font {} is missing from the config", name)),
|
||||
None => panic!("Font {} is missing from the config", name),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,9 +209,9 @@ fn create_shm_fd() -> io::Result<RawFd> {
|
||||
Err(nix::Error::Sys(errno)) => match unistd::close(fd) {
|
||||
Ok(_) => return Err(io::Error::from(errno)),
|
||||
Err(nix::Error::Sys(errno)) => return Err(io::Error::from(errno)),
|
||||
Err(err) => panic!(err),
|
||||
Err(err) => panic!("{}", err),
|
||||
},
|
||||
Err(err) => panic!(err),
|
||||
Err(err) => panic!("{}", err),
|
||||
},
|
||||
Err(nix::Error::Sys(Errno::EEXIST)) => {
|
||||
// If a file with that handle exists then change the handle
|
||||
|
||||
@@ -99,7 +99,7 @@ impl BarWidgetImpl for Alsa {
|
||||
fn value(&self) -> f32 {
|
||||
match self.get_master_volume() {
|
||||
Ok(v) => v,
|
||||
Err(e) => panic!(e),
|
||||
Err(e) => panic!("{}", e),
|
||||
}
|
||||
}
|
||||
fn color(&self) -> Color {
|
||||
@@ -107,12 +107,12 @@ impl BarWidgetImpl for Alsa {
|
||||
}
|
||||
fn inc(&mut self, diff: f32) {
|
||||
if let Err(e) = self.inc_master_volume(diff) {
|
||||
panic!(e)
|
||||
panic!("{}", e)
|
||||
}
|
||||
}
|
||||
fn set(&mut self, abs: f32) {
|
||||
if let Err(e) = self.set_master_volume(abs) {
|
||||
panic!(e)
|
||||
panic!("{}", e)
|
||||
}
|
||||
}
|
||||
fn toggle(&mut self) {}
|
||||
|
||||
Reference in New Issue
Block a user