chore: fix clippy warnings for rust 1.94 & resolve typo check (#7352)

* chore: fix clippy warnings for rust 1.94

* chore: resolve typo warnings
This commit is contained in:
David Knaack
2026-04-03 19:49:11 +02:00
committed by GitHub
parent 8f9012b277
commit 402e9cac57
4 changed files with 7 additions and 9 deletions
+3 -3
View File
@@ -74,9 +74,9 @@ get_tmpfile() {
fi fi
} }
# Test if a location is writeable by trying to write to it. Windows does not let # Test if a location is writable by trying to write to it. Windows does not let
# you test writeability other than by writing: https://stackoverflow.com/q/1999988 # you test writeability other than by writing: https://stackoverflow.com/q/1999988
test_writeable() { test_writable() {
path="${1:-}/test.txt" path="${1:-}/test.txt"
if touch "${path}" 2>/dev/null; then if touch "${path}" 2>/dev/null; then
rm "${path}" rm "${path}"
@@ -188,7 +188,7 @@ elevate_priv() {
install() { install() {
ext="$1" ext="$1"
if test_writeable "${BIN_DIR}"; then if test_writable "${BIN_DIR}"; then
sudo="" sudo=""
msg="Installing Starship, please wait…" msg="Installing Starship, please wait…"
else else
+1 -1
View File
@@ -567,7 +567,7 @@ impl DirContents {
let dir_iter = fs::read_dir(base).unwrap(); let dir_iter = fs::read_dir(base).unwrap();
let _ = dir_iter let _ = dir_iter
.filter_map(|entry| entry.ok()) .filter_map(|entry| entry.ok())
.try_for_each(|entry| tx.send(entry)); .try_for_each(|entry| tx.send(entry).map_err(Box::new));
}; };
let _ = thread::Builder::new() let _ = thread::Builder::new()
+1 -3
View File
@@ -117,11 +117,9 @@ fn get_tfm_from_project_file(path: &Path) -> Option<String> {
} }
} }
// unescape and decode the text event using the reader encoding // unescape and decode the text event using the reader encoding
Ok(Event::Text(e)) => { Ok(Event::Text(e)) if in_tfm => {
if in_tfm {
return e.decode().ok().map(std::borrow::Cow::into_owned); return e.decode().ok().map(std::borrow::Cow::into_owned);
} }
}
Ok(Event::Eof) => break, // exits the loop when reaching end of file Ok(Event::Eof) => break, // exits the loop when reaching end of file
Err(e) => { Err(e) => {
log::error!( log::error!(
+1 -1
View File
@@ -203,7 +203,7 @@ pub fn timings(args: Properties) {
}) })
.collect::<Vec<ModuleTiming>>(); .collect::<Vec<ModuleTiming>>();
modules.sort_by(|a, b| b.duration.cmp(&a.duration)); modules.sort_by_key(|m| std::cmp::Reverse(m.duration));
let max_name_width = modules.iter().map(|i| i.name_len).max().unwrap_or(0); let max_name_width = modules.iter().map(|i| i.name_len).max().unwrap_or(0);
let max_duration_width = modules.iter().map(|i| i.duration_len).max().unwrap_or(0); let max_duration_width = modules.iter().map(|i| i.duration_len).max().unwrap_or(0);