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

@@ -77,7 +77,6 @@ pub enum SupportedGameVersions {
All,
PastDate(DateTime<Utc>),
Range(DateTime<Utc>, DateTime<Utc>),
#[allow(dead_code)]
Custom(Vec<MinecraftGameVersion>),
}
@@ -232,8 +231,7 @@ fn game_version_supported(
all_game_versions
.iter()
.find(|y| y.version == x.version)
.map(|x| x.created > date)
.unwrap_or(false)
.is_some_and(|x| x.created > date)
})
}
SupportedGameVersions::Range(before, after) => {
@@ -241,8 +239,7 @@ fn game_version_supported(
all_game_versions
.iter()
.find(|y| y.version == x.version)
.map(|x| x.created > before && x.created < after)
.unwrap_or(false)
.is_some_and(|x| x.created > before && x.created < after)
})
}
SupportedGameVersions::Custom(versions) => {

View File

@@ -28,14 +28,11 @@ impl super::Validator for ModpackValidator {
archive: &mut ZipArchive<Cursor<bytes::Bytes>>,
) -> Result<ValidationResult, ValidationError> {
let pack: PackFormat = {
let mut file =
if let Ok(file) = archive.by_name("modrinth.index.json") {
file
} else {
return Ok(ValidationResult::Warning(
"Pack manifest is missing.",
));
};
let Ok(mut file) = archive.by_name("modrinth.index.json") else {
return Ok(ValidationResult::Warning(
"Pack manifest is missing.",
));
};
let mut contents = String::new();
file.read_to_string(&mut contents)?;
@@ -109,7 +106,7 @@ impl super::Validator for ModpackValidator {
|| x.starts_with("overrides/shaderpacks")
|| x.starts_with("client-overrides/shaderpacks"))
})
.flat_map(|x| x.rsplit('/').next().map(|x| x.to_string()))
.filter_map(|x| x.rsplit('/').next().map(|x| x.to_string()))
.collect::<Vec<String>>(),
})
}