cargo clippy
This commit is contained in:
parent
886bae32c8
commit
48f4d4c6c5
@ -1,3 +1,4 @@
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
|
||||
@ -28,7 +29,7 @@ impl BruteForceActor {
|
||||
pub fn clean_attempts(&mut self) {
|
||||
let keys = self.failed_attempts
|
||||
.keys()
|
||||
.map(|i| i.clone())
|
||||
.map(|i| *i)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for ip in keys {
|
||||
@ -44,8 +45,8 @@ impl BruteForceActor {
|
||||
}
|
||||
|
||||
pub fn insert_failed_attempt(&mut self, ip: IpAddr) {
|
||||
if !self.failed_attempts.contains_key(&ip) {
|
||||
self.failed_attempts.insert(ip, vec![time()]);
|
||||
if let Entry::Vacant(e) = self.failed_attempts.entry(ip) {
|
||||
e.insert(vec![time()]);
|
||||
} else {
|
||||
self.failed_attempts.get_mut(&ip).unwrap().push(time());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user