Skip to content

Commit 81d9576

Browse files
committed
refiller: remove needless has_connections() method
This is just a negation of `is_empty()` method. For reference: ``` fn is_empty(&self) -> bool { self.conns.iter().all(|conns| conns.is_empty()) } ```
1 parent 113f500 commit 81d9576

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

scylla/src/transport/connection_pool.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ impl PoolRefiller {
988988
// `last_error` must not be `None` if there is a possibility of the pool
989989
// being empty.
990990
fn update_shared_conns(&mut self, last_error: Option<ConnectionError>) {
991-
let new_conns = if !self.has_connections() {
991+
let new_conns = if self.is_empty() {
992992
Arc::new(MaybePoolConnections::Broken(last_error.unwrap()))
993993
} else {
994994
let new_conns = if let Some(sharder) = self.sharder.as_ref() {
@@ -1046,7 +1046,7 @@ impl PoolRefiller {
10461046
self.conns[shard_id].len(),
10471047
self.active_connection_count(),
10481048
);
1049-
if !self.has_connections() {
1049+
if self.is_empty() {
10501050
let _ = self.pool_empty_notifier.send(());
10511051
}
10521052
self.update_shared_conns(Some(last_error));
@@ -1152,10 +1152,6 @@ impl PoolRefiller {
11521152
);
11531153
}
11541154

1155-
fn has_connections(&self) -> bool {
1156-
self.conns.iter().any(|v| !v.is_empty())
1157-
}
1158-
11591155
fn active_connection_count(&self) -> usize {
11601156
self.conns.iter().map(Vec::len).sum::<usize>()
11611157
}

0 commit comments

Comments
 (0)