diff --git a/Cargo.lock b/Cargo.lock index 7d03a43..d8c953b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1156,19 +1156,6 @@ dependencies = [ "toml 0.8.14", ] -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.52.0", -] - [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -1606,12 +1593,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - [[package]] name = "encoding_rs" version = "0.8.34" @@ -2689,29 +2670,6 @@ dependencies = [ "hashbrown 0.14.5", ] -[[package]] -name = "indicatif" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" -dependencies = [ - "console", - "instant", - "number_prefix", - "portable-atomic", - "unicode-width", -] - -[[package]] -name = "indicatif-log-bridge" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2963046f28a204e3e3fd7e754fd90a6235da05b5378f24707ff0ec9513725ce3" -dependencies = [ - "indicatif", - "log", -] - [[package]] name = "inherent" version = "1.0.11" @@ -3560,12 +3518,6 @@ dependencies = [ "libc", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - [[package]] name = "object" version = "0.36.1" @@ -3999,16 +3951,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "pretty_env_logger" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" -dependencies = [ - "env_logger", - "log", -] - [[package]] name = "prettyplease" version = "0.2.20" @@ -5774,34 +5716,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "testsuit" -version = "0.1.0" -dependencies = [ - "async-std", - "base64 0.21.7", - "chrono", - "clap", - "futures", - "futures-core", - "http-body", - "hyper", - "indicatif", - "indicatif-log-bridge", - "log", - "pretty_env_logger", - "prost", - "prost-types", - "serde", - "thiserror", - "toml 0.7.8", - "tonic", - "tonic-build", - "tonic-web", - "tower", - "uuid", -] - [[package]] name = "thiserror" version = "1.0.62" @@ -6486,21 +6400,9 @@ dependencies = [ "getrandom", "rand", "serde", - "uuid-macro-internal", "wasm-bindgen", ] -[[package]] -name = "uuid-macro-internal" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee1cd046f83ea2c4e920d6ee9f7c3537ef928d75dce5d84a87c2c5d6b3999a3a" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.71", -] - [[package]] name = "v_htmlescape" version = "0.15.8" diff --git a/Cargo.toml b/Cargo.toml index b55c038..bc64bbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = [ "frontend", "backend", "judger", - "testsuit", + # "testsuit", "backend/migration", "grpc", "judger/plugins/rlua-54", diff --git a/backend/src/endpoint/contest.rs b/backend/src/endpoint/contest.rs index 476765e..02d8d8c 100644 --- a/backend/src/endpoint/contest.rs +++ b/backend/src/endpoint/contest.rs @@ -202,8 +202,7 @@ impl Contest for ArcServer { } else { return Err(Error::PermissionDeny( "mismatch password(root can update password without entering original password)", - ) - .into()); + )); } } } @@ -284,8 +283,8 @@ impl Contest for ArcServer { .password .as_ref() .ok_or(Error::NotInPayload("password"))?; - if !self.crypto.hash_eq(&password, &tar) { - return Err(Error::PermissionDeny("mismatched password").into()); + if !self.crypto.hash_eq(password, &tar) { + return Err(Error::PermissionDeny("mismatched password")); } } diff --git a/backend/src/endpoint/problem.rs b/backend/src/endpoint/problem.rs index 74afb08..224a386 100644 --- a/backend/src/endpoint/problem.rs +++ b/backend/src/endpoint/problem.rs @@ -200,7 +200,7 @@ impl Problem for ArcServer { .map_err(Into::::into)?; if result.rows_affected == 0 { - return Err(Error::NotInDB.into()); + return Err(Error::NotInDB); } Ok(()) }) diff --git a/backend/src/endpoint/user.rs b/backend/src/endpoint/user.rs index 904d7e9..fcd6415 100644 --- a/backend/src/endpoint/user.rs +++ b/backend/src/endpoint/user.rs @@ -112,7 +112,7 @@ impl User for ArcServer { { perm.admin()?; if new_perm > perm { - return Err(Error::RequirePermission(new_perm).into()); + return Err(Error::RequirePermission(new_perm)); } } @@ -174,11 +174,11 @@ impl User for ArcServer { let new_perm: Role = new_perm.try_into().unwrap_or_default(); let new_perm: RoleLv = new_perm.into(); if perm < new_perm { - return Err(Error::RequirePermission(new_perm).into()); + return Err(Error::RequirePermission(new_perm)); } model.permission = ActiveValue::set(new_perm as i32); if new_perm > perm { - return Err(Error::RequirePermission(new_perm).into()); + return Err(Error::RequirePermission(new_perm)); } } @@ -244,7 +244,7 @@ impl User for ArcServer { .ok_or(Error::NotInDB)?; if !self.crypto.hash_eq(req.password.as_str(), &model.password) { - return Err(Error::PermissionDeny("wrong original password").into()); + return Err(Error::PermissionDeny("wrong original password")); } let mut model = model.into_active_model(); diff --git a/backend/src/util/rate_limit.rs b/backend/src/util/rate_limit.rs index d17999e..796d53e 100644 --- a/backend/src/util/rate_limit.rs +++ b/backend/src/util/rate_limit.rs @@ -125,7 +125,7 @@ impl_list_rate_limit!(Announcement); impl RateLimit for ListUserRequest { fn get_cost(&self) -> u32 { self.size - .saturating_add(self.offset.abs() as u64 / 6) + .saturating_add(self.offset.unsigned_abs() / 6) .saturating_add(12) .min(u32::MAX as u64) as u32 } @@ -134,7 +134,7 @@ impl RateLimit for ListUserRequest { impl RateLimit for ListChatRequest { fn get_cost(&self) -> u32 { self.size - .saturating_add(self.offset.abs() as u64 / 8) + .saturating_add(self.offset.unsigned_abs() / 8) .saturating_add(3) .min(u32::MAX as u64) as u32 }