File tree 1 file changed +2
-13
lines changed
1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -125,24 +125,13 @@ where
125
125
pub ( crate ) fn wanted ( & mut self , config : & Builder < M > ) -> ApprovalIter {
126
126
let available = self . conns . len ( ) as u32 + self . pending_conns ;
127
127
let min_idle = config. min_idle . unwrap_or ( 0 ) ;
128
- let wanted = if available < min_idle {
129
- min_idle - available
130
- } else {
131
- 0
132
- } ;
133
-
128
+ let wanted = min_idle. saturating_sub ( available) ;
134
129
self . approvals ( config, wanted)
135
130
}
136
131
137
132
fn approvals ( & mut self , config : & Builder < M > , num : u32 ) -> ApprovalIter {
138
133
let current = self . num_conns + self . pending_conns ;
139
- let allowed = if current < config. max_size {
140
- config. max_size - current
141
- } else {
142
- 0
143
- } ;
144
-
145
- let num = min ( num, allowed) ;
134
+ let num = min ( num, config. max_size . saturating_sub ( current) ) ;
146
135
self . pending_conns += num;
147
136
ApprovalIter { num : num as usize }
148
137
}
You can’t perform that action at this time.
0 commit comments