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

@@ -360,15 +360,14 @@ async fn project_create_inner(
// The first multipart field must be named "data" and contain a
// JSON `ProjectCreateData` object.
let mut field = payload
.next()
.await
.map(|m| m.map_err(CreateError::MultipartError))
.unwrap_or_else(|| {
let mut field = payload.next().await.map_or_else(
|| {
Err(CreateError::MissingValueError(String::from(
"No `data` field in multipart upload",
)))
})?;
},
|m| m.map_err(CreateError::MultipartError),
)?;
let name = field.name().ok_or_else(|| {
CreateError::MissingValueError(String::from("Missing content name"))
@@ -550,8 +549,8 @@ async fn project_create_inner(
)));
};
// `index` is always valid for these lists
let created_version = versions.get_mut(index).unwrap();
let version_data = project_create_data.initial_versions.get(index).unwrap();
let created_version = &mut versions[index];
let version_data = &project_create_data.initial_versions[index];
// TODO: maybe redundant is this calculation done elsewhere?
let existing_file_names = created_version
@@ -670,10 +669,9 @@ async fn project_create_inner(
&team_member,
);
if !perms
.map(|x| x.contains(OrganizationPermissions::ADD_PROJECT))
.unwrap_or(false)
{
if !perms.is_some_and(|x| {
x.contains(OrganizationPermissions::ADD_PROJECT)
}) {
return Err(CreateError::CustomAuthenticationError(
"You do not have the permissions to create projects in this organization!"
.to_string(),