chore(clippy): enable and fix many stricter lints (#3783)

* chore(clippy): enable and fix many stricter lints

These ensure that the codebase uses more idiomatic, performant, and
concise language constructions.

* chore: make non-Clippy compiler warnings also deny by default
This commit is contained in:
Alejandro González
2025-06-14 02:10:12 +02:00
committed by GitHub
parent 301967d204
commit f84f8c1c2b
106 changed files with 542 additions and 760 deletions

View File

@@ -80,10 +80,9 @@ pub async fn fetch_advanced(
) -> crate::Result<Bytes> {
let _permit = semaphore.0.acquire().await?;
let creds = if !header
let creds = if header
.as_ref()
.map(|x| &*x.0.to_lowercase() == "authorization")
.unwrap_or(false)
.is_none_or(|x| &*x.0.to_lowercase() != "authorization")
&& (url.starts_with("https://cdn.modrinth.com")
|| url.starts_with(MODRINTH_API_URL)
|| url.starts_with(MODRINTH_API_URL_V3))

View File

@@ -227,13 +227,11 @@ async fn get_all_jre_path() -> HashSet<PathBuf> {
paths.unwrap_or_else(|_| HashSet::new())
}
#[cfg(target_os = "windows")]
#[allow(dead_code)]
pub const JAVA_BIN: &str = "javaw.exe";
#[cfg(not(target_os = "windows"))]
#[allow(dead_code)]
pub const JAVA_BIN: &str = "java";
pub const JAVA_BIN: &str = if cfg!(target_os = "windows") {
"javaw.exe"
} else {
"java"
};
// For each example filepath in 'paths', perform check_java_at_filepath, checking each one concurrently
// and returning a JavaVersion for every valid path that points to a java bin
@@ -249,7 +247,7 @@ pub async fn check_java_at_filepaths(
.collect::<Vec<_>>()
.await;
jres.into_iter().flat_map(|x| x.ok()).flatten().collect()
jres.into_iter().filter_map(|x| x.ok()).flatten().collect()
}
// For example filepath 'path', attempt to resolve it and get a Java version at this path