1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-11-21 15:54:18 +00:00

Apply clippy lints

This commit is contained in:
Steffo 2024-09-13 03:31:20 +02:00
parent c4392f012b
commit 0d1235b742
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
4 changed files with 5 additions and 5 deletions

View file

@ -45,7 +45,7 @@ pub(crate) async fn handler(
log::trace!("Connection rate limit is: {count} / 60 s");
if count > 0 {
log::trace!("Checking rate limit...");
let result = super::limit::rate_limit_by_key(&mut handle_redis, &rate_limit_key, 1, count, 60).await;
let result = super::limit::rate_limit_by_key(&mut handle_redis, rate_limit_key, 1, count, 60).await;
if result.is_err() {
return Err::<(), StatusCode>(StatusCode::BAD_REQUEST).into_response()
}

View file

@ -12,7 +12,7 @@ pub async fn rate_limit_by_key(
) -> Result<usize, CloseCode> {
log::trace!("Incrementing rate limit counter for {key:?}...");
let response: usize = redis::cmd("INCRBY")
.arg(&key)
.arg(key)
.arg(increment)
.query_async::<redis::aio::Connection, usize>(rconn).await
.log_err_to_error("Could not increase rate limit counter")
@ -20,7 +20,7 @@ pub async fn rate_limit_by_key(
log::trace!("Refreshing rate limit counter expiration for {key:?}...");
let _ = redis::cmd("EXPIRE")
.arg(&key)
.arg(key)
.arg(expiration_s)
.query_async::<redis::aio::Connection, ()>(rconn).await
.log_err_to_warn("Could not set expiration for rate limit counter");

View file

@ -4,7 +4,7 @@ use crate::task::{v1, VersionedBoardChange};
pub async fn xread_to_vbc(r: StreamReadReply) -> (Vec<VersionedBoardChange>, String) {
log::trace!("Making sure that the Redis Stream existed...");
let r = r.keys.get(0);
let r = r.keys.first();
let mut current_id: String = "0".to_string();

View file

@ -24,7 +24,7 @@ pub async fn handler(
log::trace!("Connection rate limit is: {count} / 60 s");
if count > 0 {
log::trace!("Checking rate limit...");
let result = super::limit::rate_limit_by_key(&mut rconn, &rate_limit_key, 1, count, 60).await;
let result = super::limit::rate_limit_by_key(&mut rconn, rate_limit_key, 1, count, 60).await;
if result.is_err() {
log::warn!("Hit rate limit, closing connection.");
return Err(1008u16);