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
+9 -12
View File
@@ -120,7 +120,7 @@ impl Prompt {
}
fn append(&mut self, v: &str) {
if self.input.len() == 0 {
if self.input.is_empty() {
match v {
"!" => {
self.mode = PromptMode::Shell;
@@ -271,7 +271,7 @@ impl Launcher {
Launcher {
next_token: None,
options: options,
options,
matches: Vec::new(),
launch_cmd,
}
@@ -354,7 +354,7 @@ impl InterfaceWidget for Launcher {
.auto_draw_text_with_cursor(
&mut prompt_line,
fg,
&format!(" {}", &intf.prompt.input),
&format!(" {}", intf.prompt.input),
intf.prompt.cursor + 3,
)
.unwrap();
@@ -474,7 +474,7 @@ impl InterfaceWidget for Shell {
.auto_draw_text_with_cursor(
&mut prompt_line,
fg,
&format!(" {}", &intf.prompt.input),
&format!(" {}", intf.prompt.input),
intf.prompt.cursor + 3,
)
.unwrap();
@@ -531,7 +531,7 @@ impl Calc {
let old = self.old.lock().unwrap();
for (input, res) in old.iter() {
write!(f, "{}={}\n", input, res).unwrap();
writeln!(f, "{}={}", input, res).unwrap();
}
f.sync_data().unwrap();
}
@@ -567,10 +567,7 @@ impl InterfaceWidget for Calc {
rcalc_lib::parse::eval(&intf.prompt.input, &mut rcalc_lib::parse::CalcState::new())
.map(|x| format!("{}", x))
.map_err(|x| format!("{}", x));
self.result = match res {
Ok(v) => Some(v),
Err(_) => None,
};
self.result = res.ok();
}
fn draw(
@@ -593,7 +590,7 @@ impl InterfaceWidget for Calc {
font.auto_draw_text_with_cursor(
&mut prompt_line,
fg,
&format!(" {} ", &intf.prompt.input),
&format!(" {} ", intf.prompt.input),
intf.prompt.cursor + 3,
)
.unwrap();
@@ -712,7 +709,7 @@ impl Interface {
}
fn exit(&mut self) {
if self.inner.prompt.input.len() == 0 {
if self.inner.prompt.input.is_empty() {
std::process::exit(0);
}
@@ -810,7 +807,7 @@ impl Widget for Interface {
}
fn geometry_update(&mut self, _fonts: &mut FontMap, geometry: &Geometry) -> Geometry {
self.inner.geometry = geometry.clone();
self.inner.geometry = *geometry;
self.inner.geometry
}