prefer 'if let' to 'Option::map'
@@ -172,11 +172,11 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
tokio::task::spawn_local(request.send().promise.map(
move |r| match r {
Ok(_) => {
- subscribers2.borrow_mut().subscribers.get_mut(&idx).map(
- |ref mut s| {
+ if let Some(ref mut s) =
+ subscribers2.borrow_mut().subscribers.get_mut(&idx)
+ {
s.requests_in_flight -= 1;
- },
- );
+ }
}
Err(e) => {
println!("Got error: {:?}. Dropping subscriber.", e);
