mirror of
https://github.com/starship/starship.git
synced 2026-06-22 02:02:12 +07:00
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:
+3
-3
@@ -74,9 +74,9 @@ get_tmpfile() {
|
||||
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
|
||||
test_writeable() {
|
||||
test_writable() {
|
||||
path="${1:-}/test.txt"
|
||||
if touch "${path}" 2>/dev/null; then
|
||||
rm "${path}"
|
||||
@@ -188,7 +188,7 @@ elevate_priv() {
|
||||
install() {
|
||||
ext="$1"
|
||||
|
||||
if test_writeable "${BIN_DIR}"; then
|
||||
if test_writable "${BIN_DIR}"; then
|
||||
sudo=""
|
||||
msg="Installing Starship, please wait…"
|
||||
else
|
||||
|
||||
+1
-1
@@ -567,7 +567,7 @@ impl DirContents {
|
||||
let dir_iter = fs::read_dir(base).unwrap();
|
||||
let _ = dir_iter
|
||||
.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()
|
||||
|
||||
@@ -117,11 +117,9 @@ fn get_tfm_from_project_file(path: &Path) -> Option<String> {
|
||||
}
|
||||
}
|
||||
// unescape and decode the text event using the reader encoding
|
||||
Ok(Event::Text(e)) => {
|
||||
if in_tfm {
|
||||
Ok(Event::Text(e)) if in_tfm => {
|
||||
return e.decode().ok().map(std::borrow::Cow::into_owned);
|
||||
}
|
||||
}
|
||||
Ok(Event::Eof) => break, // exits the loop when reaching end of file
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
|
||||
+1
-1
@@ -203,7 +203,7 @@ pub fn timings(args: Properties) {
|
||||
})
|
||||
.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_duration_width = modules.iter().map(|i| i.duration_len).max().unwrap_or(0);
|
||||
|
||||
Reference in New Issue
Block a user