Skip to content

Commit

Permalink
clippy fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeshadow committed Jan 19, 2024
1 parent 495a85f commit 6140d8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions http-rate/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ mod test {
#[test]
fn coverage() {
let display_output = format!("{}", InsufficientCapacity(3));
assert!(display_output.contains("3"));
assert!(display_output.contains('3'));
let debug_output = format!("{:?}", InsufficientCapacity(3));
assert!(debug_output.contains("3"));
assert!(debug_output.contains('3'));
assert_eq!(InsufficientCapacity(3), InsufficientCapacity(3));
}
}
6 changes: 3 additions & 3 deletions http-rate/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// #![allow(unused)]
#![allow(clippy::declare_interior_mutable_const)]

mod error;
mod gcra;
Expand Down Expand Up @@ -72,8 +72,8 @@ fn maybe_forwarded(headers: &HeaderMap) -> Option<IpAddr> {
.get_all(FORWARDED)
.iter()
.filter_map(|h| h.to_str().ok())
.map(|val| val.split(';').into_iter().map(|p| p.split(',')).flatten())
.flatten()
.flat_map(|val| val.split(';'))
.flat_map(|p| p.split(','))
.map(|val| val.trim().splitn(2, '='))
{
if let (Some(name), Some(val)) = (val.next(), val.next()) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/middleware/rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<S, E> Service<Result<S, E>> for RateLimit {
async fn call(&self, res: Result<S, E>) -> Result<Self::Response, Self::Error> {
res.map(|service| RateLimitService {
service,
rate_limit: http_rate::RateLimit::new(self.0.clone()),
rate_limit: http_rate::RateLimit::new(self.0),
})
}
}
Expand Down

0 comments on commit 6140d8b

Please sign in to comment.