diff --git a/Cargo.toml b/Cargo.toml index 87eeccdb5..5a56527fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,46 +27,37 @@ exclude = [ ] [features] -default = [] +default = ["compat-3-0-0", "rustls-tls", "dns-resolver"] +compat-3-0-0 = [] sync = [] -openssl-tls = ["openssl", "openssl-probe", "tokio-openssl"] - -# Enable support for v0.4 of the chrono crate in the public API of the BSON library. -bson-chrono-0_4 = ["bson/chrono-0_4"] - -# Enable support for the serde_with crate in the BSON library. -bson-serde_with = ["bson/serde_with"] - -# Enable support for v0.8 of the uuid crate in the public API of the BSON library. -bson-uuid-0_8 = ["bson/uuid-0_8"] - -# Enable support for v1.x of the uuid crate in the public API of the BSON library. -bson-uuid-1 = ["bson/uuid-1"] +rustls-tls = ["dep:rustls", "dep:rustls-pemfile", "dep:tokio-rustls"] +openssl-tls = ["dep:openssl", "dep:openssl-probe", "dep:tokio-openssl"] +dns-resolver = ["dep:trust-dns-resolver", "dep:trust-dns-proto"] # Enable support for MONGODB-AWS authentication. # This can only be used with the tokio-runtime feature flag. -aws-auth = ["reqwest"] +aws-auth = ["dep:reqwest"] # Enable support for on-demand Azure KMS credentials. # This can only be used with the tokio-runtime feature flag. -azure-kms = ["reqwest"] +azure-kms = ["dep:reqwest"] # Enable support for on-demand GCP KMS credentials. # This can only be used with the tokio-runtime feature flag. -gcp-kms = ["reqwest"] +gcp-kms = ["dep:reqwest"] -zstd-compression = ["zstd"] -zlib-compression = ["flate2"] -snappy-compression = ["snap"] +zstd-compression = ["dep:zstd"] +zlib-compression = ["dep:flate2"] +snappy-compression = ["dep:snap"] # Enables support for client-side field level encryption and queryable encryption. # The In Use Encryption API is unstable and may have backwards-incompatible changes in minor version updates. -in-use-encryption-unstable = ["mongocrypt", "rayon", "num_cpus"] +in-use-encryption-unstable = ["dep:mongocrypt", "dep:rayon", "dep:num_cpus"] # Enables support for emitting tracing events. # The tracing API is unstable and may have backwards-incompatible changes in minor version updates. # TODO: pending https://github.com/tokio-rs/tracing/issues/2036 stop depending directly on log. -tracing-unstable = ["tracing", "log"] +tracing-unstable = ["dep:tracing", "dep:log"] [dependencies] action_macro = { path = "action_macro" } @@ -95,7 +86,7 @@ percent-encoding = "2.0.0" rand = { version = "0.8.3", features = ["small_rng"] } rayon = { version = "1.5.3", optional = true } rustc_version_runtime = "0.2.1" -rustls-pemfile = "1.0.1" +rustls-pemfile = { version = "1.0.1", optional = true } serde_with = "1.3.1" sha-1 = "0.10.0" sha2 = "0.10.2" @@ -107,8 +98,8 @@ take_mut = "0.2.2" thiserror = "1.0.24" tokio-openssl = { version = "0.6.3", optional = true } tracing = { version = "0.1.36", optional = true } -trust-dns-proto = "0.21.2" -trust-dns-resolver = "0.21.2" +trust-dns-proto = { version = "0.21.2", optional = true } +trust-dns-resolver = { version = "0.21.2", optional = true } typed-builder = "0.10.0" webpki-roots = "0.25.2" zstd = { version = "0.11.2", optional = true } @@ -125,6 +116,7 @@ features = ["json", "rustls-tls"] [dependencies.rustls] version = "0.21.6" +optional = true features = ["dangerous_configuration"] [dependencies.serde] @@ -140,6 +132,7 @@ features = ["io-util", "sync", "macros", "net", "process", "rt", "time"] [dependencies.tokio-rustls] version = "0.24.1" +optional = true features = ["dangerous_configuration"] [dependencies.tokio-util] diff --git a/README.md b/README.md index 0ae7af057..d8decbac8 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,6 @@ features = ["sync"] |:---------------------|:--------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------|:--------| | `sync` | Expose the synchronous API (`mongodb::sync`). | n/a | no | | `aws-auth` | Enable support for the MONGODB-AWS authentication mechanism. | `reqwest` | no | -| `bson-uuid-0_8` | Enable support for v0.8 of the [`uuid`](docs.rs/uuid/0.8) crate in the public API of the re-exported `bson` crate. | n/a | no | -| `bson-uuid-1` | Enable support for v1.x of the [`uuid`](docs.rs/uuid/1.0) crate in the public API of the re-exported `bson` crate. | n/a | no | -| `bson-chrono-0_4` | Enable support for v0.4 of the [`chrono`](docs.rs/chrono/0.4) crate in the public API of the re-exported `bson` crate. | n/a | no | -| `bson-serde_with` | Enable support for the [`serde_with`](docs.rs/serde_with/latest) crate in the public API of the re-exported `bson` crate. | `serde_with` | no | | `zlib-compression` | Enable support for compressing messages with [`zlib`](https://zlib.net/) | `flate2` | no | | `zstd-compression` | Enable support for compressing messages with [`zstd`](http://facebook.github.io/zstd/). | `zstd` | no | | `snappy-compression` | Enable support for compressing messages with [`snappy`](http://google.github.io/snappy/) | `snap` | no | diff --git a/manual/src/installation_features.md b/manual/src/installation_features.md index be345237f..746bc89a6 100644 --- a/manual/src/installation_features.md +++ b/manual/src/installation_features.md @@ -22,10 +22,6 @@ features = ["sync"] |:---------------------|:--------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:--------| | `sync` | Expose the synchronous API (`mongodb::sync`). | n/a | no | | `aws-auth` | Enable support for the MONGODB-AWS authentication mechanism. | `reqwest` 0.11 | no | -| `bson-uuid-0_8` | Enable support for v0.8 of the [`uuid`](docs.rs/uuid/0.8) crate in the public API of the re-exported `bson` crate. | n/a | no | -| `bson-uuid-1` | Enable support for v1.x of the [`uuid`](docs.rs/uuid/1.0) crate in the public API of the re-exported `bson` crate. | n/a | no | -| `bson-chrono-0_4` | Enable support for v0.4 of the [`chrono`](docs.rs/chrono/0.4) crate in the public API of the re-exported `bson` crate. | n/a | no | -| `bson-serde_with` | Enable support for the [`serde_with`](docs.rs/serde_with/latest) crate in the public API of the re-exported `bson` crate. | `serde_with` 1.0 | no | | `zlib-compression` | Enable support for compressing messages with [`zlib`](https://zlib.net/) | `flate2` 1.0 | no | | `zstd-compression` | Enable support for compressing messages with [`zstd`](http://facebook.github.io/zstd/). This flag requires Rust version 1.54. | `zstd` 0.9.0 | no | | `snappy-compression` | Enable support for compressing messages with [`snappy`](http://google.github.io/snappy/) | `snap` 1.0.5 | no | diff --git a/src/action/client_options.rs b/src/action/client_options.rs index 3e984c009..4c09fd1fb 100644 --- a/src/action/client_options.rs +++ b/src/action/client_options.rs @@ -95,6 +95,7 @@ pub struct ParseConnectionString { impl ParseConnectionString { /// In the case that "mongodb+srv" is used, SRV and TXT record lookups will be done using the /// provided `ResolverConfig` as part of this method. + #[cfg(feature = "dns-resolver")] pub fn resolver_config(mut self, value: ResolverConfig) -> Self { self.resolver_config = Some(value); self diff --git a/src/client.rs b/src/client.rs index cbd0c4009..3783abdd2 100644 --- a/src/client.rs +++ b/src/client.rs @@ -478,7 +478,7 @@ impl Client { } } - #[cfg(test)] + #[cfg(all(test, feature = "dns-resolver"))] pub(crate) fn get_hosts(&self) -> Vec { let watcher = self.inner.topology.watch(); let state = watcher.peek_latest(); diff --git a/src/client/options.rs b/src/client/options.rs index af8ed6dca..fee9476bf 100644 --- a/src/client/options.rs +++ b/src/client/options.rs @@ -5,7 +5,6 @@ mod parse; mod resolver_config; use std::{ - borrow::Cow, cmp::Ordering, collections::HashSet, convert::TryFrom, @@ -45,7 +44,10 @@ use crate::{ srv::{OriginalSrvInfo, SrvResolver}, }; +#[cfg(feature = "dns-resolver")] pub use resolver_config::ResolverConfig; +#[cfg(not(feature = "dns-resolver"))] +pub(crate) use resolver_config::ResolverConfig; pub(crate) const DEFAULT_PORT: u16 = 27017; @@ -253,14 +255,16 @@ impl ServerAddress { }) } - pub(crate) fn host(&self) -> Cow<'_, str> { + #[cfg(feature = "dns-resolver")] + pub(crate) fn host(&self) -> std::borrow::Cow<'_, str> { match self { - Self::Tcp { host, .. } => Cow::Borrowed(host.as_str()), + Self::Tcp { host, .. } => std::borrow::Cow::Borrowed(host.as_str()), #[cfg(unix)] Self::Unix { path } => path.to_string_lossy(), } } + #[cfg(feature = "dns-resolver")] pub(crate) fn port(&self) -> Option { match self { Self::Tcp { port, .. } => *port, @@ -597,6 +601,7 @@ pub struct ClientOptions { #[builder(default, setter(skip))] #[serde(skip)] #[derivative(Debug = "ignore")] + #[cfg(feature = "dns-resolver")] pub(crate) resolver_config: Option, /// Control test behavior of the client. @@ -932,8 +937,7 @@ impl HostInfo { Ok(match self { Self::HostIdentifiers(hosts) => ResolvedHostInfo::HostIdentifiers(hosts), Self::DnsRecord(hostname) => { - let mut resolver = - SrvResolver::new(resolver_config.clone().map(|config| config.inner)).await?; + let mut resolver = SrvResolver::new(resolver_config.clone()).await?; let config = resolver.resolve_client_options(&hostname).await?; ResolvedHostInfo::DnsRecord { hostname, config } } @@ -1264,6 +1268,17 @@ impl ClientOptions { MIN_HEARTBEAT_FREQUENCY } } + + pub(crate) fn resolver_config(&self) -> Option<&ResolverConfig> { + #[cfg(feature = "dns-resolver")] + { + self.resolver_config.as_ref() + } + #[cfg(not(feature = "dns-resolver"))] + { + None + } + } } /// Splits a string into a section before a given index and a section exclusively after the index. @@ -1359,6 +1374,13 @@ impl ConnectionString { .into()) } }; + #[cfg(not(feature = "dns-resolver"))] + if srv { + return Err(Error::invalid_argument( + "mongodb+srv connection strings cannot be used when the 'dns-resolver' feature is \ + disabled", + )); + } let after_scheme = &s[end_of_scheme + 3..]; diff --git a/src/client/options/parse.rs b/src/client/options/parse.rs index 20d1f71ad..c8542068d 100644 --- a/src/client/options/parse.rs +++ b/src/client/options/parse.rs @@ -19,7 +19,10 @@ impl Action for ParseConnectionString { .is_some(); let host_info = std::mem::take(&mut conn_str.host_info); let mut options = ClientOptions::from_connection_string(conn_str); - options.resolver_config = self.resolver_config.clone(); + #[cfg(feature = "dns-resolver")] + { + options.resolver_config = self.resolver_config.clone(); + } let resolved = host_info.resolve(self.resolver_config).await?; options.hosts = match resolved { @@ -146,6 +149,7 @@ impl ClientOptions { original_srv_info: None, #[cfg(test)] original_uri: Some(conn_str.original_uri), + #[cfg(feature = "dns-resolver")] resolver_config: None, server_api: None, load_balanced: conn_str.load_balanced, diff --git a/src/client/options/resolver_config.rs b/src/client/options/resolver_config.rs index 67d556c2a..f0715d38a 100644 --- a/src/client/options/resolver_config.rs +++ b/src/client/options/resolver_config.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "dns-resolver")] use trust_dns_resolver::config::ResolverConfig as TrustDnsResolverConfig; /// Configuration for the upstream nameservers to use for resolution. @@ -6,9 +7,11 @@ use trust_dns_resolver::config::ResolverConfig as TrustDnsResolverConfig; /// API stability. #[derive(Clone, Debug, PartialEq)] pub struct ResolverConfig { + #[cfg(feature = "dns-resolver")] pub(crate) inner: TrustDnsResolverConfig, } +#[cfg(feature = "dns-resolver")] impl ResolverConfig { /// Creates a default configuration, using 1.1.1.1, 1.0.0.1 and 2606:4700:4700::1111, /// 2606:4700:4700::1001 (thank you, Cloudflare). diff --git a/src/error.rs b/src/error.rs index 054fbc471..c28f63985 100644 --- a/src/error.rs +++ b/src/error.rs @@ -267,6 +267,7 @@ impl Error { self.labels.insert(label); } + #[cfg(feature = "dns-resolver")] pub(crate) fn from_resolve_error(error: trust_dns_resolver::error::ResolveError) -> Self { ErrorKind::DnsResolve { message: error.to_string(), diff --git a/src/lib.rs b/src/lib.rs index 123c45cf9..0e787b198 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,10 +35,6 @@ //! |:-----------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------| //! | `sync` | Expose the synchronous API (`mongodb::sync`). | no | //! | `aws-auth` | Enable support for the MONGODB-AWS authentication mechanism. | no | -//! | `bson-uuid-0_8` | Enable support for v0.8 of the [`uuid`](docs.rs/uuid/0.8) crate in the public API of the re-exported `bson` crate. | no | -//! | `bson-uuid-1` | Enable support for v1.x of the [`uuid`](docs.rs/uuid/1.0) crate in the public API of the re-exported `bson` crate. | no | -//! | `bson-chrono-0_4` | Enable support for v0.4 of the [`chrono`](docs.rs/chrono/0.4) crate in the public API of the re-exported `bson` crate. | no | -//! | `bson-serde_with` | Enable support for the [`serde_with`](docs.rs/serde_with/latest) crate in the public API of the re-exported `bson` crate. | no | //! | `zlib-compression` | Enable support for compressing messages with [`zlib`](https://zlib.net/). | no | //! | `zstd-compression` | Enable support for compressing messages with [`zstd`](http://facebook.github.io/zstd/). | no | //! | `snappy-compression` | Enable support for compressing messages with [`snappy`](http://google.github.io/snappy/). | no | @@ -142,9 +138,9 @@ //! ``` //! //! ### Finding documents in a collection -//! Results from queries are generally returned via [`Cursor`](struct.Cursor.html), a struct which streams -//! the results back from the server as requested. The [`Cursor`](struct.Cursor.html) type implements the -//! [`Stream`](https://docs.rs/futures/latest/futures/stream/trait.Stream.html) trait from +//! Results from queries are generally returned via [`Cursor`](struct.Cursor.html), a struct which +//! streams the results back from the server as requested. The [`Cursor`](struct.Cursor.html) type +//! implements the [`Stream`](https://docs.rs/futures/latest/futures/stream/trait.Stream.html) trait from //! the [`futures`](https://crates.io/crates/futures) crate, and in order to access its streaming //! functionality you need to import at least one of the //! [`StreamExt`](https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html) or @@ -236,14 +232,14 @@ //! In async Rust, it is common to implement cancellation and timeouts by dropping a future after a //! certain period of time instead of polling it to completion. This is how //! [`tokio::time::timeout`](https://docs.rs/tokio/1.10.1/tokio/time/fn.timeout.html) works, for -//! example. However, doing this with futures returned by the driver can leave the driver's internals in -//! an inconsistent state, which may lead to unpredictable or incorrect behavior (see RUST-937 for more -//! details). As such, it is **_highly_** recommended to poll all futures returned from the driver to -//! completion. In order to still use timeout mechanisms like `tokio::time::timeout` with the driver, -//! one option is to spawn tasks and time out on their +//! example. However, doing this with futures returned by the driver can leave the driver's +//! internals in an inconsistent state, which may lead to unpredictable or incorrect behavior (see +//! RUST-937 for more details). As such, it is **_highly_** recommended to poll all futures returned +//! from the driver to completion. In order to still use timeout mechanisms like +//! `tokio::time::timeout` with the driver, one option is to spawn tasks and time out on their //! [`JoinHandle`](https://docs.rs/tokio/1.10.1/tokio/task/struct.JoinHandle.html) futures instead of on -//! the driver's futures directly. This will ensure the driver's futures will always be completely polled -//! while also allowing the application to continue in the event of a timeout. +//! the driver's futures directly. This will ensure the driver's futures will always be completely +//! polled while also allowing the application to continue in the event of a timeout. //! //! e.g. //! ``` rust @@ -268,8 +264,8 @@ //! //! ## Minimum supported Rust version (MSRV) //! -//! The MSRV for this crate is currently 1.64.0. This will be rarely be increased, and if it ever is, -//! it will only happen in a minor or major version release. +//! The MSRV for this crate is currently 1.64.0. This will be rarely be increased, and if it ever +//! is, it will only happen in a minor or major version release. #![warn(missing_docs)] #![warn(rustdoc::missing_crate_level_docs)] @@ -289,7 +285,6 @@ #![cfg_attr(test, type_length_limit = "80000000")] #![doc(html_root_url = "https://docs.rs/mongodb/2.8.0")] - #[macro_use] pub mod options; @@ -318,8 +313,8 @@ mod index; mod operation; pub mod results; pub(crate) mod runtime; -mod search_index; mod sdam; +mod search_index; mod selection_criteria; mod serde_util; mod srv; @@ -344,7 +339,17 @@ pub use crate::{ gridfs::{GridFsBucket, GridFsDownloadStream, GridFsUploadStream}, }; -pub use {client::session::ClusterTime, coll::Namespace, index::IndexModel, sdam::public::*, search_index::SearchIndexModel}; +pub use client::session::ClusterTime; +pub use coll::Namespace; +pub use index::IndexModel; +pub use sdam::public::*; +pub use search_index::SearchIndexModel; /// A boxed future. -pub type BoxFuture<'a, T> = std::pin::Pin + Send + 'a>>; \ No newline at end of file +pub type BoxFuture<'a, T> = std::pin::Pin + Send + 'a>>; + +#[cfg(not(feature = "compat-3-0-0"))] +compile_error!( + "The feature 'compat-3-0-0' must be enabled to ensure forward compatibility with future \ + versions of this crate." +); diff --git a/src/runtime.rs b/src/runtime.rs index 0ff87cb27..3b41dc5dd 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1,35 +1,40 @@ mod acknowledged_message; -#[cfg(feature = "reqwest")] +#[cfg(any(feature = "aws-auth", feature = "azure-kms", feature = "gcp-kms"))] mod http; mod join_handle; #[cfg(any(feature = "in-use-encryption-unstable", test))] pub(crate) mod process; +#[cfg(feature = "dns-resolver")] mod resolver; pub(crate) mod stream; mod sync_read_ext; #[cfg(feature = "openssl-tls")] mod tls_openssl; +#[cfg(feature = "rustls-tls")] #[cfg_attr(feature = "openssl-tls", allow(unused))] mod tls_rustls; mod worker_handle; use std::{future::Future, net::SocketAddr, time::Duration}; +#[cfg(feature = "dns-resolver")] +pub(crate) use self::resolver::AsyncResolver; pub(crate) use self::{ acknowledged_message::{AcknowledgedMessage, AcknowledgmentReceiver, AcknowledgmentSender}, join_handle::AsyncJoinHandle, - resolver::AsyncResolver, stream::AsyncStream, sync_read_ext::SyncLittleEndianRead, worker_handle::{WorkerHandle, WorkerHandleListener}, }; use crate::{error::Result, options::ServerAddress}; -#[cfg(feature = "reqwest")] +#[cfg(any(feature = "aws-auth", feature = "azure-kms", feature = "gcp-kms"))] pub(crate) use http::HttpClient; #[cfg(feature = "openssl-tls")] use tls_openssl as tls; -#[cfg(not(feature = "openssl-tls"))] +#[cfg(all(feature = "rustls-tls", not(feature = "openssl-tls")))] use tls_rustls as tls; +#[cfg(not(any(feature = "rustls-tls", feature = "openssl-tls")))] +compile_error!("At least one of the features 'rustls-tls' or 'openssl-tls' must be enabled."); pub(crate) use tls::TlsConfig; diff --git a/src/sdam/srv_polling.rs b/src/sdam/srv_polling.rs index adc93273b..21598e5ce 100644 --- a/src/sdam/srv_polling.rs +++ b/src/sdam/srv_polling.rs @@ -130,8 +130,7 @@ impl SrvPollingMonitor { return Ok(resolver); } - let resolver = - SrvResolver::new(self.client_options.resolver_config.clone().map(|c| c.inner)).await?; + let resolver = SrvResolver::new(self.client_options.resolver_config().cloned()).await?; // Since the connection was not `Some` above, this will always insert the new connection and // return a reference to it. diff --git a/src/srv.rs b/src/srv.rs index 3bda9e74c..7c5e60c8a 100644 --- a/src/srv.rs +++ b/src/srv.rs @@ -1,17 +1,8 @@ use std::time::Duration; -use trust_dns_proto::rr::RData; -use trust_dns_resolver::config::ResolverConfig; - -use crate::{ - error::{ErrorKind, Result}, - options::ServerAddress, - runtime::AsyncResolver, -}; - -pub(crate) struct SrvResolver { - resolver: AsyncResolver, -} +#[cfg(feature = "dns-resolver")] +use crate::error::ErrorKind; +use crate::{client::options::ResolverConfig, error::Result, options::ServerAddress}; #[derive(Debug)] pub(crate) struct ResolvedConfig { @@ -35,13 +26,20 @@ pub(crate) struct OriginalSrvInfo { } pub(crate) enum DomainMismatch { + #[allow(dead_code)] Error, Skip, } +#[cfg(feature = "dns-resolver")] +pub(crate) struct SrvResolver { + resolver: crate::runtime::AsyncResolver, +} + +#[cfg(feature = "dns-resolver")] impl SrvResolver { pub(crate) async fn new(config: Option) -> Result { - let resolver = AsyncResolver::new(config).await?; + let resolver = crate::runtime::AsyncResolver::new(config.map(|c| c.inner)).await?; Ok(Self { resolver }) } @@ -69,6 +67,8 @@ impl SrvResolver { original_hostname: &str, dm: DomainMismatch, ) -> Result { + use trust_dns_proto::rr::RData; + let hostname_parts: Vec<_> = original_hostname.split('.').collect(); if hostname_parts.len() < 3 { @@ -247,3 +247,35 @@ impl SrvResolver { Ok(()) } } + +/// Stub implementation when dns resolution isn't enabled. +#[cfg(not(feature = "dns-resolver"))] +pub(crate) struct SrvResolver {} + +#[cfg(not(feature = "dns-resolver"))] +impl SrvResolver { + pub(crate) async fn new(_config: Option) -> Result { + Ok(Self {}) + } + + pub(crate) async fn resolve_client_options( + &mut self, + _hostname: &str, + ) -> Result { + Err(crate::error::Error::invalid_argument( + "mongodb+srv connection strings cannot be used when the 'dns-resolver' feature is \ + disabled", + )) + } + + pub(crate) async fn get_srv_hosts( + &self, + _original_hostname: &str, + _dm: DomainMismatch, + ) -> Result { + return Err(crate::error::Error::invalid_argument( + "mongodb+srv connection strings cannot be used when the 'dns-resolver' feature is \ + disabled", + )); + } +} diff --git a/src/test.rs b/src/test.rs index 5855e5937..e7dd6f47f 100644 --- a/src/test.rs +++ b/src/test.rs @@ -1,6 +1,7 @@ #![allow(clippy::cast_possible_truncation)] #![allow(clippy::cast_possible_wrap)] +#[cfg(feature = "dns-resolver")] mod atlas_connectivity; mod atlas_planned_maintenance_testing; #[cfg(feature = "aws-auth")] diff --git a/src/test/spec.rs b/src/test/spec.rs index 06e390115..94abd9cf3 100644 --- a/src/test/spec.rs +++ b/src/test/spec.rs @@ -10,6 +10,7 @@ mod crud_v1; mod faas; mod gridfs; mod index_management; +#[cfg(feature = "dns-resolver")] mod initial_dns_seedlist_discovery; mod load_balancers; mod ocsp; diff --git a/src/test/spec/v2_runner/test_file.rs b/src/test/spec/v2_runner/test_file.rs index b622162ab..0f1c1c988 100644 --- a/src/test/spec/v2_runner/test_file.rs +++ b/src/test/spec/v2_runner/test_file.rs @@ -99,6 +99,7 @@ impl RunOn { #[serde(untagged)] pub(crate) enum TestData { Single(Vec), + #[allow(dead_code)] Many(HashMap>), } diff --git a/tests/readme_examples.rs b/tests/readme_examples.rs index 094b1c358..7ac94afdf 100644 --- a/tests/readme_examples.rs +++ b/tests/readme_examples.rs @@ -145,6 +145,7 @@ async fn _using_the_sync_api() -> Result<()> { Ok(()) } +#[cfg(feature = "dns-resolver")] async fn _windows_dns_note() -> Result<()> { use mongodb::{ options::{ClientOptions, ResolverConfig},