diff --git a/src/client/options/mod.rs b/src/client/options/mod.rs index 8d69cadc3..88f09569b 100644 --- a/src/client/options/mod.rs +++ b/src/client/options/mod.rs @@ -681,9 +681,10 @@ impl ClientOptions { /// used in the SRV tests. #[cfg(test)] pub(crate) fn new_srv() -> Self { - let mut options = Self::default(); - options.original_srv_hostname = Some("localhost.test.test.build.10gen.cc".into()); - options + Self { + original_srv_hostname: Some("localhost.test.test.build.10gen.cc".into()), + ..Default::default() + } } /// Parses a MongoDB connection string into a ClientOptions struct. If the string is malformed diff --git a/src/cmap/test/integration.rs b/src/cmap/test/integration.rs index 193642016..340ba93a1 100644 --- a/src/cmap/test/integration.rs +++ b/src/cmap/test/integration.rs @@ -122,20 +122,22 @@ async fn concurrent_connections() { }); futures::future::join_all(tasks).await; - // ensure all three ConnectionCreatedEvents were emitted before one ConnectionReadyEvent. - let events = handler.events.read().unwrap(); - let mut consecutive_creations = 0; - for event in events.iter() { - match event { - Event::ConnectionCreated(_) => { - consecutive_creations += 1; - } - Event::ConnectionReady(_) => { - if consecutive_creations < 2 { - panic!("connections not created concurrently"); + { + // ensure all three ConnectionCreatedEvents were emitted before one ConnectionReadyEvent. + let events = handler.events.read().unwrap(); + let mut consecutive_creations = 0; + for event in events.iter() { + match event { + Event::ConnectionCreated(_) => { + consecutive_creations += 1; + } + Event::ConnectionReady(_) => { + if consecutive_creations < 2 { + panic!("connections not created concurrently"); + } } + _ => (), } - _ => (), } }