Skip to content

Commit 8b6e94a

Browse files
committed
Even more clippy changes.
1 parent 321b4ae commit 8b6e94a

File tree

2 files changed

+103
-113
lines changed

2 files changed

+103
-113
lines changed

src/pool.rs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,17 @@ impl ConnectionPool {
241241
let old_pool_ref = get_pool(pool_name, &user.username);
242242
let identifier = PoolIdentifier::new(pool_name, &user.username);
243243

244-
match old_pool_ref {
245-
Some(pool) => {
246-
// If the pool hasn't changed, get existing reference and insert it into the new_pools.
247-
// We replace all pools at the end, but if the reference is kept, the pool won't get re-created (bb8).
248-
if pool.config_hash == new_pool_hash_value {
249-
info!(
250-
"[pool: {}][user: {}] has not changed",
251-
pool_name, user.username
252-
);
253-
new_pools.insert(identifier.clone(), pool.clone());
254-
continue;
255-
}
244+
if let Some(pool) = old_pool_ref {
245+
// If the pool hasn't changed, get existing reference and insert it into the new_pools.
246+
// We replace all pools at the end, but if the reference is kept, the pool won't get re-created (bb8).
247+
if pool.config_hash == new_pool_hash_value {
248+
info!(
249+
"[pool: {}][user: {}] has not changed",
250+
pool_name, user.username
251+
);
252+
new_pools.insert(identifier.clone(), pool.clone());
253+
continue;
256254
}
257-
None => (),
258255
}
259256

260257
info!(
@@ -399,7 +396,7 @@ impl ConnectionPool {
399396
},
400397
};
401398

402-
let reaper_rate = *vec![idle_timeout, server_lifetime, POOL_REAPER_RATE]
399+
let reaper_rate = *[idle_timeout, server_lifetime, POOL_REAPER_RATE]
403400
.iter()
404401
.min()
405402
.unwrap();
@@ -489,7 +486,7 @@ impl ConnectionPool {
489486
.clone()
490487
.map(|regex| Regex::new(regex.as_str()).unwrap()),
491488
regex_search_limit: pool_config.regex_search_limit.unwrap_or(1000),
492-
default_shard: pool_config.default_shard.clone(),
489+
default_shard: pool_config.default_shard,
493490
auth_query: pool_config.auth_query.clone(),
494491
auth_query_user: pool_config.auth_query_user.clone(),
495492
auth_query_password: pool_config.auth_query_password.clone(),
@@ -678,7 +675,7 @@ impl ConnectionPool {
678675
let mut force_healthcheck = false;
679676

680677
if self.is_banned(address) {
681-
if self.try_unban(&address).await {
678+
if self.try_unban(address).await {
682679
force_healthcheck = true;
683680
} else {
684681
debug!("Address {:?} is banned", address);
@@ -806,8 +803,8 @@ impl ConnectionPool {
806803
// Don't leave a bad connection in the pool.
807804
server.mark_bad();
808805

809-
self.ban(&address, BanReason::FailedHealthCheck, Some(client_info));
810-
return false;
806+
self.ban(address, BanReason::FailedHealthCheck, Some(client_info));
807+
false
811808
}
812809

813810
/// Ban an address (i.e. replica). It no longer will serve
@@ -931,10 +928,10 @@ impl ConnectionPool {
931928
let guard = self.banlist.read();
932929
for banlist in guard.iter() {
933930
for (address, (reason, timestamp)) in banlist.iter() {
934-
bans.push((address.clone(), (reason.clone(), timestamp.clone())));
931+
bans.push((address.clone(), (reason.clone(), *timestamp)));
935932
}
936933
}
937-
return bans;
934+
bans
938935
}
939936

940937
/// Get the address from the host url
@@ -992,7 +989,7 @@ impl ConnectionPool {
992989
}
993990
let busy = provisioned - idle;
994991
debug!("{:?} has {:?} busy connections", address, busy);
995-
return busy;
992+
busy
996993
}
997994

998995
fn valid_shard_id(&self, shard: Option<usize>) -> bool {
@@ -1031,6 +1028,7 @@ pub struct ServerPool {
10311028
}
10321029

10331030
impl ServerPool {
1031+
#[allow(clippy::too_many_arguments)]
10341032
pub fn new(
10351033
address: Address,
10361034
user: User,

0 commit comments

Comments
 (0)