Skip to content

Commit

Permalink
minor: fix clippy errors on 1.49 (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
saghm authored Jan 6, 2021
1 parent d4a9559 commit 0a0f82f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/client/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 14 additions & 12 deletions src/cmap/test/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
_ => (),
}
_ => (),
}
}

Expand Down

0 comments on commit 0a0f82f

Please sign in to comment.