Skip to content

Commit 4758403

Browse files
committed
refactor: is_some_and
1 parent 79854fd commit 4758403

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

msg-socket/src/rep/driver.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,14 @@ where
248248
let span = this.span.clone().entered();
249249

250250
// Reject incoming connections if we have `max_clients` active clients already
251-
if let Some(max) = this.options.max_clients {
252-
if this.state.stats.specific.active_clients() >= max {
253-
warn!(
254-
limit = max,
255-
"max connections reached, rejecting new incoming connection",
256-
);
251+
let active_clients = this.state.stats.specific.active_clients();
252+
if this.options.max_clients.is_some_and(|max| active_clients >= max) {
253+
warn!(
254+
active_clients,
255+
"max connections reached, rejecting new incoming connection",
256+
);
257257

258-
continue;
259-
}
258+
continue;
260259
}
261260

262261
// Increment the active clients counter.

0 commit comments

Comments
 (0)