Taplo and typos in CI, TOML cleanup (#4510)

* Taplo and typos in CI

* Clean up Cargo.toml files

* Fix CI

* Fix CI

* Run typos in CI

* Loosen typos a bit

* Fix typos

* Fix taplo

* Switch to Tombi

* Fix Tombi errors

* Remove unused typos config

* Tombi fmt

* Remove extraneous cargo fmt

* fix typos
This commit is contained in:
aecsocket
2025-10-12 21:18:38 +01:00
committed by GitHub
parent ea594ec27c
commit 4cd8ccd319
46 changed files with 650 additions and 468 deletions

View File

@@ -1,7 +1,6 @@
[package]
name = "labrinth"
version = "2.7.0"
authors = ["geometrically <jai@modrinth.com>"]
edition.workspace = true
license = "AGPL-3.0-only"
@@ -11,148 +10,140 @@ name = "labrinth"
path = "src/main.rs"
[dependencies]
actix-web.workspace = true
actix-rt.workspace = true
actix-multipart.workspace = true
actix-cors.workspace = true
actix-ws.workspace = true
actix-files.workspace = true
prometheus.workspace = true
actix-cors = { workspace = true }
actix-files = { workspace = true }
actix-multipart = { workspace = true }
actix-rt = { workspace = true }
actix-web = { workspace = true }
actix-web-prom = { workspace = true, features = ["process"] }
tracing.workspace = true
tracing-actix-web.workspace = true
console-subscriber.workspace = true
tracing-subscriber.workspace = true
tracing-ecs.workspace = true
eyre.workspace = true
color-eyre.workspace = true
tokio = { workspace = true, features = ["sync", "rt-multi-thread"] }
tokio-stream.workspace = true
futures.workspace = true
futures-util.workspace = true
async-trait.workspace = true
dashmap.workspace = true
paste.workspace = true
meilisearch-sdk = { workspace = true, features = ["reqwest"] }
rust-s3.workspace = true
reqwest = { workspace = true, features = ["http2", "rustls-tls-webpki-roots", "json", "multipart"] }
hyper-rustls.workspace = true
hyper-util.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
serde_with.workspace = true
actix-ws = { workspace = true }
argon2 = { workspace = true }
ariadne = { workspace = true }
async-stripe = { workspace = true, features = [
"billing",
"checkout",
"connect",
"webhook-events",
] }
async-trait = { workspace = true }
base64 = { workspace = true }
bitflags = { workspace = true }
bytes = { workspace = true }
censor = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
yaserde = { workspace = true, features = ["derive"] }
rand.workspace = true
rand_chacha.workspace = true
bytes.workspace = true
base64.workspace = true
sha1.workspace = true
sha2.workspace = true
hmac.workspace = true
argon2.workspace = true
murmur2.workspace = true
bitflags.workspace = true
hex.workspace = true
zxcvbn.workspace = true
totp-rs = { workspace = true, features = ["gen_secret"] }
const_format.workspace = true
url.workspace = true
urlencoding.workspace = true
zip.workspace = true
itertools.workspace = true
validator = { workspace = true, features = ["derive"] }
regex.workspace = true
censor.workspace = true
spdx = { workspace = true, features = ["text"] }
dotenvy.workspace = true
thiserror.workspace = true
either.workspace = true
sqlx = { workspace = true, features = [
"runtime-tokio",
"tls-rustls-ring",
"postgres",
"chrono",
"macros",
"migrate",
"rust_decimal",
"json",
] }
rust_decimal = { workspace = true, features = ["serde-with-float", "serde-with-str"] }
redis = { workspace = true, features = ["tokio-comp", "ahash", "r2d2"] }
deadpool-redis.workspace = true
clickhouse = { workspace = true, features = ["uuid", "time"] }
uuid = { workspace = true, features = ["v4", "fast-rng", "serde"] }
maxminddb.workspace = true
flate2.workspace = true
tar.workspace = true
sentry.workspace = true
sentry-actix.workspace = true
image = { workspace = true, features = [
"avif",
"bmp",
"dds",
"exr",
"ff",
"gif",
"hdr",
"ico",
"jpeg",
"png",
"pnm",
"qoi",
"tga",
"tiff",
"webp",
] }
color-thief.workspace = true
webp.workspace = true
woothee.workspace = true
lettre.workspace = true
rust_iso3166.workspace = true
async-stripe = { workspace = true, features = ["billing", "checkout", "connect", "webhook-events"] }
rusty-money.workspace = true
json-patch.workspace = true
ariadne.workspace = true
path-util.workspace = true
clap = { workspace = true, features = ["derive"] }
[target.'cfg(target_os = "linux")'.dependencies]
tikv-jemallocator = { workspace = true, features = [
"profiling",
"unprefixed_malloc_on_supported_platforms",
clickhouse = { workspace = true, features = ["time", "uuid"] }
color-eyre = { workspace = true }
color-thief = { workspace = true }
console-subscriber = { workspace = true }
const_format = { workspace = true }
dashmap = { workspace = true }
deadpool-redis.workspace = true
dotenvy = { workspace = true }
either = { workspace = true }
eyre = { workspace = true }
flate2 = { workspace = true }
futures = { workspace = true }
futures-util = { workspace = true }
hex = { workspace = true }
hmac = { workspace = true }
hyper-rustls = { workspace = true }
hyper-util = { workspace = true }
image = { workspace = true, features = [
"avif",
"bmp",
"dds",
"exr",
"ff",
"gif",
"hdr",
"ico",
"jpeg",
"png",
"pnm",
"qoi",
"tga",
"tiff",
"webp",
] }
tikv-jemalloc-ctl = { workspace = true, features = ["stats"] }
jemalloc_pprof = { workspace = true, features = ["flamegraph"] }
itertools = { workspace = true }
json-patch = { workspace = true }
lettre = { workspace = true }
maxminddb = { workspace = true }
meilisearch-sdk = { workspace = true, features = ["reqwest"] }
murmur2 = { workspace = true }
paste = { workspace = true }
path-util = { workspace = true }
prometheus = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
redis = { workspace = true, features = ["ahash", "r2d2", "tokio-comp"] }
regex = { workspace = true }
reqwest = { workspace = true, features = [
"http2",
"json",
"multipart",
"rustls-tls-webpki-roots",
] }
rust_decimal = { workspace = true, features = [
"serde-with-float",
"serde-with-str",
] }
rust_iso3166 = { workspace = true }
rust-s3 = { workspace = true }
rusty-money = { workspace = true }
sentry = { workspace = true }
sentry-actix = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
serde_with = { workspace = true }
sha1 = { workspace = true }
sha2 = { workspace = true }
spdx = { workspace = true, features = ["text"] }
sqlx = { workspace = true, features = [
"chrono",
"json",
"macros",
"migrate",
"postgres",
"runtime-tokio",
"rust_decimal",
"tls-rustls-ring",
] }
tar = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "sync"] }
tokio-stream = { workspace = true }
totp-rs = { workspace = true, features = ["gen_secret"] }
tracing = { workspace = true }
tracing-actix-web = { workspace = true }
tracing-ecs = { workspace = true }
tracing-subscriber = { workspace = true }
url = { workspace = true }
urlencoding = { workspace = true }
uuid = { workspace = true, features = ["fast-rng", "serde", "v4"] }
validator = { workspace = true, features = ["derive"] }
webp = { workspace = true }
woothee = { workspace = true }
yaserde = { workspace = true, features = ["derive"] }
zip = { workspace = true }
zxcvbn = { workspace = true }
[dev-dependencies]
actix-http.workspace = true
actix-http = { workspace = true }
[build-dependencies]
dotenv-build.workspace = true
chrono.workspace = true
iana-time-zone.workspace = true
chrono = { workspace = true }
dotenv-build = { workspace = true }
iana-time-zone = { workspace = true }
[target.'cfg(target_os = "linux")'.dependencies]
jemalloc_pprof = { workspace = true, features = ["flamegraph"] }
tikv-jemalloc-ctl = { workspace = true, features = ["stats"] }
tikv-jemallocator = { workspace = true, features = [
"profiling",
"unprefixed_malloc_on_supported_platforms",
] }
[lints]
workspace = true

View File

@@ -20,7 +20,7 @@ use validator::Validate;
/// A project returned from the API
#[derive(Serialize, Deserialize, Clone)]
pub struct LegacyProject {
/// Relevant V2 fields- these were removed or modfified in V3,
/// Relevant V2 fields- these were removed or modified in V3,
/// and are now part of the dynamic fields system
/// The support range for the client project*
pub client_side: LegacySideType,
@@ -269,7 +269,7 @@ impl std::fmt::Display for LegacySideType {
}
impl LegacySideType {
// These are constant, so this can remove unneccessary allocations (`to_string`)
// These are constant, so this can remove unnecessary allocations (`to_string`)
pub fn as_str(&self) -> &'static str {
match self {
LegacySideType::Required => "required",
@@ -292,7 +292,7 @@ impl LegacySideType {
/// A specific version of a project
#[derive(Serialize, Deserialize, Clone)]
pub struct LegacyVersion {
/// Relevant V2 fields- these were removed or modfified in V3,
/// Relevant V2 fields- these were removed or modified in V3,
/// and are now part of the dynamic fields system
/// A list of game versions this project supports
pub game_versions: Vec<String>,

View File

@@ -22,7 +22,7 @@ pub struct Collection {
/// Color of the collection.
pub color: Option<u32>,
/// The status of the collectin (eg: whether collection is public or not)
/// The status of the collection (eg: whether collection is public or not)
pub status: CollectionStatus,
/// The date at which the collection was first published.

View File

@@ -650,7 +650,7 @@ impl NotificationDeliveryStatus {
NotificationDeliveryStatus::Delivered => Ok(()),
NotificationDeliveryStatus::SkippedPreferences |
NotificationDeliveryStatus::SkippedDefault |
NotificationDeliveryStatus::Pending => Err(ApiError::InvalidInput("An error occured while sending an email to your email address. Please try again later.".to_owned())),
NotificationDeliveryStatus::Pending => Err(ApiError::InvalidInput("An error occurred while sending an email to your email address. Please try again later.".to_owned())),
NotificationDeliveryStatus::PermanentlyFailed => Err(ApiError::InvalidInput("This email address doesn't exist! Please try another one.".to_owned())),
}
}

View File

@@ -20,7 +20,7 @@ pub struct Project {
pub id: ProjectId,
/// The slug of a project, used for vanity URLs
pub slug: Option<String>,
/// The aggregated project typs of the versions of this project
/// The aggregated project typos of the versions of this project
pub project_types: Vec<String>,
/// The aggregated games of the versions of this project
pub games: Vec<String>,
@@ -49,7 +49,7 @@ pub struct Project {
/// The status of the project
pub status: ProjectStatus,
/// The requested status of this projct
/// The requested status of this project
pub requested_status: Option<ProjectStatus>,
/// DEPRECATED: moved to threads system

View File

@@ -65,7 +65,7 @@ impl std::fmt::Display for ThreadType {
}
impl ThreadType {
// These are constant, so this can remove unneccessary allocations (`to_string`)
// These are constant, so this can remove unnecessary allocations (`to_string`)
pub fn as_str(&self) -> &'static str {
match self {
ThreadType::Report => "report",

View File

@@ -502,7 +502,7 @@ async fn update_anrok_transactions(
/// Attempts to process a user redeemal.
///
/// Returns `Ok` if the entry has been succesfully processed, or will not be processed.
/// Returns `Ok` if the entry has been successfully processed, or will not be processed.
pub async fn try_process_user_redeemal(
pool: &PgPool,
redis: &RedisPool,

View File

@@ -75,7 +75,7 @@ pub enum AttachedCharge {
/// This can be used in the case of resubscription flows. The amount from this
/// charge will be used, but the tax will be recalculated and the charge updated.
///
/// The charge's status will NOT be updated - it is the caller's responsability to
/// The charge's status will NOT be updated - it is the caller's responsibility to
/// update the charge's status on failure or success.
///
/// This may be accompanied by an automated payment session.
@@ -160,7 +160,7 @@ pub struct PaymentBootstrapOptions<'a> {
///
/// Taxes will always be collected.
///
/// Note the charge will NOT be updated. It is the caller's responsability to update the charge
/// Note the charge will NOT be updated. It is the caller's responsibility to update the charge
/// on success or failure.
pub payment_session: PaymentSession,
/// The charge the payment intent on should be based upon.
@@ -185,7 +185,7 @@ pub struct PaymentBootstrapResults {
///
/// # Important notes
///
/// - This function does not perform any database writes. It is the caller's responsability to, for
/// - This function does not perform any database writes. It is the caller's responsibility to, for
/// example, update the charge's status on success or failure, or update the charge's tax amount,
/// tax eligibility or payment and tax platform IDs.
/// - You may not update or create a payment intent for an off-session payment flow without

View File

@@ -1,4 +1,4 @@
//! TODO: this module should be removed; it is superceded by `analytics_get`
//! TODO: this module should be removed; it is superseded by `analytics_get`
use super::ApiError;
use crate::database;
@@ -412,7 +412,7 @@ pub async fn revenue_get(
/// Get country data for a set of projects or versions
/// Data is returned as a hashmap of project/version ids to a hashmap of coutnry to downloads.
/// Unknown countries are labeled "".
/// This is usuable to see significant performing countries per project
/// This is usable to see significant performing countries per project
/// eg:
/// {
/// "4N1tEhnO": {
@@ -485,7 +485,7 @@ pub async fn countries_downloads_get(
/// Get country data for a set of projects or versions
/// Data is returned as a hashmap of project/version ids to a hashmap of coutnry to views.
/// Unknown countries are labeled "".
/// This is usuable to see significant performing countries per project
/// This is usable to see significant performing countries per project
/// eg:
/// {
/// "4N1tEhnO": {

View File

@@ -355,7 +355,7 @@ pub async fn index_local(
}
// SPECIAL BEHAVIOUR:
// For consitency with v2 searching, we manually input the
// For consistency with v2 searching, we manually input the
// client_side and server_side fields from the loader fields into
// separate loader fields.
// 'client_side' and 'server_side' remain supported by meilisearch even though they are no longer v3 fields.

View File

@@ -33,7 +33,7 @@ pub struct FormResponse {
pub company_name: String,
pub company_email: String,
pub reference_id: String,
/// This is a DateTime, but it's not consistent wether it has a
/// This is a DateTime, but it's not consistent whether it has a
/// timezone or not, so we just parse it as a string and use [`Utc::now()`](fn@chrono::Utc::now)
/// rather than using the provided DateTime.
pub signed_at: Option<String>,

View File

@@ -198,7 +198,7 @@ pub async fn delete_old_images(
// check changes to associated images
// if they no longer exist in the String list, delete them
// Eg: if description is modified and no longer contains a link to an iamge
// Eg: if description is modified and no longer contains a link to an image
pub async fn delete_unused_images(
context: ImageContext,
reference_strings: Vec<&str>,

View File

@@ -129,7 +129,7 @@ impl ApiVersion for ApiV3 {
modify_json,
);
// Add a versiom.
// Add a version.
let req = TestRequest::post()
.uri("/v3/version")
.append_pat(pat)

View File

@@ -59,7 +59,7 @@ impl TemporaryDatabase {
let database_url =
dotenvy::var("DATABASE_URL").expect("No database URL");
// Create the temporary (and template datbase, if needed)
// Create the temporary (and template database, if needed)
Self::create_temporary(&database_url, &temp_database_name).await;
// Pool to the temporary database
@@ -102,7 +102,7 @@ impl TemporaryDatabase {
}
}
// Creates a template and temporary databse (panics)
// Creates a template and temporary database (panics)
// 1. Waits to obtain a pg lock on the main database
// 2. Creates a new template database called 'TEMPLATE_DATABASE_NAME', if needed
// 3. Switches to the template database

View File

@@ -390,7 +390,7 @@ pub async fn add_project_beta(api: &ApiV3) -> (Project, Version) {
}
pub async fn add_organization_zeta(api: &ApiV3) -> Organization {
// Add an organzation.
// Add an organization.
let req = TestRequest::post()
.uri("/v3/organization")
.append_pat(USER_USER_PAT)

View File

@@ -35,7 +35,7 @@ pub struct PermissionsTest<'a, A: Api> {
user_pat: Option<&'a str>,
// Whether or not the user ID should be removed from the project/organization team after the test
// (This is mostly reelvant if you are also using an existing project/organization, and want to do
// (This is mostly relevant if you are also using an existing project/organization, and want to do
// multiple tests with the same user.
remove_user: bool,
@@ -1056,10 +1056,10 @@ async fn create_dummy_org(setup_api: &ApiV3) -> (String, String) {
let organization = setup_api
.get_organization_deserialized(&slug, ADMIN_USER_PAT)
.await;
let organizaion_id = organization.id.to_string();
let organization_id = organization.id.to_string();
let team_id = organization.team_id.to_string();
(organizaion_id, team_id)
(organization_id, team_id)
}
async fn add_project_to_org(

View File

@@ -61,7 +61,7 @@ pub async fn pat_full_test() {
let mock_pat_test = |token: &str| {
let token = token.to_string();
async {
// This uses a route directly instead of an api call because it doesn't relaly matter and we
// This uses a route directly instead of an api call because it doesn't really matter and we
// want it to succeed no matter what.
// This is an arbitrary request.
let req = test::TestRequest::post()

View File

@@ -419,7 +419,7 @@ pub async fn test_patch_project() {
.await;
assert_status!(&resp, StatusCode::UNAUTHORIZED);
// Sucessful request to patch many fields.
// Successful request to patch many fields.
let resp = api
.edit_project(
alpha_project_slug,
@@ -500,7 +500,7 @@ pub async fn test_patch_v3() {
let alpha_project_slug = &test_env.dummy.project_alpha.project_slug;
// Sucessful request to patch many fields.
// Successful request to patch many fields.
let resp = api
.edit_project(
alpha_project_slug,
@@ -1141,7 +1141,7 @@ async fn permissions_delete_project() {
async fn project_permissions_consistency_test() {
with_test_environment_all(Some(10), |test_env| async move {
// Test that the permissions are consistent with each other
// For example, if we get the projectpermissions directly, from an organization's defaults, overriden, etc, they should all be correct & consistent
// For example, if we get the projectpermissions directly, from an organization's defaults, overridden, etc, they should all be correct & consistent
let api = &test_env.api;
// Full project permissions test with EDIT_DETAILS
let success_permissions = ProjectPermissions::EDIT_DETAILS;

View File

@@ -535,7 +535,7 @@ async fn test_patch_organization_team_member() {
}).await;
}
// trasnfer ownership (requires being owner, etc)
// transfer ownership (requires being owner, etc)
#[actix_rt::test]
async fn transfer_ownership_v3() {
// Test setup and dummy data
@@ -675,7 +675,7 @@ async fn transfer_ownership_v3() {
// // Adding a user to a project team in an organization, when that user is in the organization but not the team,
// // should have those permissions apply regardless of whether the user has accepted the invite or not.
// // This is because project-team permission overrriding must be possible, and this overriding can decrease the number of permissions a user has.
// // This is because project-team permission overriding must be possible, and this overriding can decrease the number of permissions a user has.
// let test_env = TestEnvironment::build(None).await;
// let api = &test_env.api;

View File

@@ -103,7 +103,7 @@ async fn test_project_type_sanity() {
);
}
// As we get more complicated strucures with as v3 continues to expand, and alpha/beta get more complicated, we should add more tests here,
// As we get more complicated structures with as v3 continues to expand, and alpha/beta get more complicated, we should add more tests here,
// to ensure that projects created with v3 routes are still valid and work with v3 routes.
},
)
@@ -413,7 +413,7 @@ pub async fn test_patch_v2() {
let alpha_project_slug = &test_env.dummy.project_alpha.project_slug;
// Sucessful request to patch many fields.
// Successful request to patch many fields.
let resp = api
.edit_project(
alpha_project_slug,
@@ -433,7 +433,7 @@ pub async fn test_patch_v2() {
// Note: the original V2 value of this was "optional",
// but Required/Optional is no longer a carried combination in v3, as the changes made were lossy.
// Now, the test Required/Unsupported combination is tested instead.
// Setting Required/Optional in v2 will not work, this is known and accepteed.
// Setting Required/Optional in v2 will not work, this is known and accepted.
assert_eq!(project.client_side.as_str(), "unsupported");
assert_eq!(project.server_side.as_str(), "required");
},

View File

@@ -15,7 +15,7 @@ use crate::{
},
};
// trasnfer ownership (requires being owner, etc)
// transfer ownership (requires being owner, etc)
#[actix_rt::test]
async fn transfer_ownership_v2() {
// Test setup and dummy data

View File

@@ -56,7 +56,7 @@ pub async fn test_patch_version() {
assert_status!(&resp, StatusCode::BAD_REQUEST);
}
// Sucessful request to patch many fields.
// Successful request to patch many fields.
let resp = api
.edit_version(
alpha_version_id,

View File

@@ -3,7 +3,7 @@ pub mod common;
// Not all tests expect exactly the same functionality in v2 and v3.
// For example, though we expect the /GET version to return the corresponding project,
// we may want to do different checks for each.
// (such as checking client_side in v2, but loader fields on v3- which are model-exclusie)
// (such as checking client_side in v2, but loader fields on v3- which are model-exclusive)
// Such V2 tests are exported here
mod v2 {

View File

@@ -439,7 +439,7 @@ pub async fn test_patch_version() {
assert_status!(&resp, StatusCode::BAD_REQUEST);
}
// Sucessful request to patch many fields.
// Successful request to patch many fields.
let resp = api
.edit_version(
alpha_version_id,