X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Futils%2Fsrc%2Frate_limit%2Fmod.rs;h=1bb6f1b5f4e1279f3642b8a6b2c246c4569626a2;hb=92568956353f21649ed9aff68b42699c9d036f30;hp=d1c51265d5f1d59d8ccec10a52781cfb61bfa288;hpb=45818fb4c50dc06f6909312bd034f68af92c3146;p=lemmy.git diff --git a/crates/utils/src/rate_limit/mod.rs b/crates/utils/src/rate_limit/mod.rs index d1c51265..1bb6f1b5 100644 --- a/crates/utils/src/rate_limit/mod.rs +++ b/crates/utils/src/rate_limit/mod.rs @@ -1,4 +1,4 @@ -use crate::error::LemmyError; +use crate::error::{LemmyError, LemmyErrorType}; use actix_web::dev::{ConnectionInfo, Service, ServiceRequest, ServiceResponse, Transform}; use enum_map::enum_map; use futures::future::{ok, Ready}; @@ -246,7 +246,7 @@ where } else { let (http_req, _) = req.into_parts(); Ok(ServiceResponse::from_err( - LemmyError::from_message("rate_limit_error"), + LemmyError::from(LemmyErrorType::RateLimitError), http_req, )) } @@ -275,6 +275,9 @@ fn parse_ip(addr: &str) -> Option { #[cfg(test)] mod tests { + #![allow(clippy::unwrap_used)] + #![allow(clippy::indexing_slicing)] + #[test] fn test_parse_ip() { let ip_addrs = [