mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-07-22 14:13:33 +00:00
Switch to Edition 2024, more clippy lints, and less macro calls (#7200)
* Update to Rust 2024 Edition Updated to the Rust 2024 Edition and added and fixed several lint checks. This is a large change which, because of the extra lints, added some possible fixes for issues. Signed-off-by: BlackDex <black.dex@gmail.com> * Reorder and merge imports Signed-off-by: BlackDex <black.dex@gmail.com> * Remove "db_run!" macro calls where possible Signed-off-by: BlackDex <black.dex@gmail.com> --------- Signed-off-by: BlackDex <black.dex@gmail.com>
This commit is contained in:
committed by
GitHub
parent
22f5e0496c
commit
1ba2c6a26c
+4
-4
@@ -1,8 +1,8 @@
|
||||
use std::{net::IpAddr, num::NonZeroU32, sync::LazyLock, time::Duration};
|
||||
|
||||
use governor::{clock::DefaultClock, state::keyed::DashMapStateStore, Quota, RateLimiter};
|
||||
use governor::{Quota, RateLimiter, clock::DefaultClock, state::keyed::DashMapStateStore};
|
||||
|
||||
use crate::{Error, CONFIG};
|
||||
use crate::{CONFIG, Error};
|
||||
|
||||
type Limiter<T = IpAddr> = RateLimiter<T, DashMapStateStore<T>, DefaultClock>;
|
||||
|
||||
@@ -20,7 +20,7 @@ static LIMITER_ADMIN: LazyLock<Limiter> = LazyLock::new(|| {
|
||||
|
||||
pub fn check_limit_login(ip: &IpAddr) -> Result<(), Error> {
|
||||
match LIMITER_LOGIN.check_key(ip) {
|
||||
Ok(_) => Ok(()),
|
||||
Ok(()) => Ok(()),
|
||||
Err(_e) => {
|
||||
err_code!("Too many login requests", 429);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ pub fn check_limit_login(ip: &IpAddr) -> Result<(), Error> {
|
||||
|
||||
pub fn check_limit_admin(ip: &IpAddr) -> Result<(), Error> {
|
||||
match LIMITER_ADMIN.check_key(ip) {
|
||||
Ok(_) => Ok(()),
|
||||
Ok(()) => Ok(()),
|
||||
Err(_e) => {
|
||||
err_code!("Too many admin requests", 429);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user