clippy: clean up all warnings

Mostly `cargo clippy --fix`: needless borrows, redundant field names,
match -> if let, io::Error::other, Option::filter/map, let chains, c""
literals. By hand: drop unused impl lifetimes, a type alias for the
font preload map, Iterator::find in next_buffer, contains_key, and
allow new_ret_no_self where constructors intentionally return the
boxed/generic wrapper type.

No functional change; tests and release build unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Bendik Aagaard Lynghaug
2026-10-03 09:20:25 +00:00
co-authored by Claude Fable 5.1
parent 42ffe9c492
commit 1c6a536026
20 changed files with 153 additions and 190 deletions
+7 -6
View File
@@ -67,15 +67,15 @@ fn monitor(
let local_inner = inner.clone();
let local_events = events.clone();
context.borrow_mut().set_subscribe_callback(Some(Box::new(
move |facility, _operation, index| match facility {
Some(Facility::Sink) => {
move |facility, _operation, index| {
if let Some(Facility::Sink) = facility {
let introspector = local_context.borrow_mut().introspect();
let inner = local_inner.clone();
let events = local_events.clone();
introspector.get_sink_info_by_index(index, move |res| match res {
ListResult::End | ListResult::Error => (),
ListResult::Item(sink_info) => {
if let Some(_) = &sink_info.name {
if sink_info.name.is_some() {
let avg = sink_info.volume.avg().0 as f32 / Volume::NORMAL.0 as f32;
let mut inner = inner.lock().unwrap();
inner.volume = avg;
@@ -88,7 +88,6 @@ fn monitor(
}
});
}
_ => (),
},
)));
@@ -101,7 +100,7 @@ fn monitor(
introspector.get_sink_info_by_name("@DEFAULT_SINK@", move |res| match res {
ListResult::End | ListResult::Error => (),
ListResult::Item(sink_info) => {
if let Some(_) = &sink_info.name {
if sink_info.name.is_some() {
let avg = sink_info.volume.avg().0 as f32 / Volume::NORMAL.0 as f32;
let mut inner = local_inner.lock().unwrap();
inner.volume = avg;
@@ -119,7 +118,7 @@ fn monitor(
let local_context = context.clone();
let local_inner = inner.clone();
let event_source = mainloop.new_io_event(
pipe as i32,
pipe,
IoFlagSet::INPUT,
Box::new(move |_, _, _| {
let mut buf = [0; 8];
@@ -201,6 +200,8 @@ pub struct PulseAudio {
}
impl PulseAudio {
// Wraps the impl in the generic BarWidget on purpose.
#[allow(clippy::new_ret_no_self)]
pub fn new(
events: Arc<Mutex<Events>>,
fm: &mut FontMap,