Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .evergreen/MSRV-Cargo.toml.diff
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
76c76
79c79
< derive_more = "0.99.17"
---
> derive_more = "=0.99.17"
112a113
100c100
< serde_with = "3.8.1"
---
> serde_with = "=3.5.1"
115a116
> url = "=2.5.0"
167c168
170c171
< time = "0.3.9"
---
> time = "=0.3.9"
> time = "=0.3.20"
15 changes: 10 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ async-trait = "0.1.42"
base64 = "0.13.0"
bitflags = "1.1.0"
bson = { git = "https://github.com/mongodb/bson-rust", branch = "main" }
chrono = { version = "0.4.7", default-features = false, features = ["clock", "std"] }
chrono = { version = "0.4.7", default-features = false, features = [
"clock",
"std",
] }
derivative = "2.1.1"
derive_more = "0.99.17"
flate2 = { version = "1.0", optional = true }
Expand All @@ -92,15 +95,15 @@ openssl-probe = { version = "0.1.5", optional = true }
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"
rustc_version_runtime = "0.3.0"
rustls-pemfile = { version = "1.0.1", optional = true }
serde_with = "1.3.1"
serde_with = "3.8.1"
sha-1 = "0.10.0"
sha2 = "0.10.2"
snap = { version = "1.0.5", optional = true }
socket2 = "0.5.5"
stringprep = "0.1.2"
strsim = "0.10.0"
strsim = "0.11.1"
take_mut = "0.2.2"
thiserror = "1.0.24"
tokio-openssl = { version = "0.6.3", optional = true }
Expand Down Expand Up @@ -176,4 +179,6 @@ rustdoc-args = ["--cfg", "docsrs"]
all-features = true

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(mongodb_internal_tracking_arc)'] }
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(mongodb_internal_tracking_arc)',
] }
55 changes: 25 additions & 30 deletions src/client/options/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,6 @@ async fn run_connection_string_spec_tests() {
run_tests(&["connection-string"], &skipped_files).await;
}

async fn parse_uri(option: &str, suggestion: Option<&str>) {
match ConnectionString::parse(format!("mongodb://host:27017/?{}=test", option))
.map_err(|e| *e.kind)
{
Ok(_) => panic!("expected error for option {}", option),
Err(ErrorKind::InvalidArgument { message, .. }) => {
match suggestion {
Some(s) => assert!(message.contains(s)),
None => assert!(!message.contains("similar")),
};
}
Err(e) => panic!("expected InvalidArgument, but got {:?}", e),
}
}

#[tokio::test]
async fn uuid_representations() {
let mut uuid_repr = parse_uri_with_uuid_representation("csharpLegacy")
Expand Down Expand Up @@ -316,21 +301,31 @@ async fn parse_uri_with_uuid_representation(
}
}

#[tokio::test]
async fn parse_unknown_options() {
parse_uri("invalidoption", None).await;
parse_uri("x", None).await;
parse_uri("max", None).await;
parse_uri("tlstimeout", None).await;
parse_uri("waitqueuetimeout", Some("waitqueuetimeoutms")).await;
parse_uri("retry_reads", Some("retryreads")).await;
parse_uri("poolsize", Some("maxpoolsize")).await;
parse_uri(
"tlspermitinvalidcertificates",
Some("tlsallowinvalidcertificates"),
)
.await;
parse_uri("maxstalenessms", Some("maxstalenessseconds")).await;
#[test]
fn parse_unknown_options() {
fn parse_uri(option: &str, suggestion: Option<&str>) {
match ConnectionString::parse(format!("mongodb://host:27017/?{}=test", option))
.map_err(|e| *e.kind)
{
Ok(_) => panic!("expected error for option {}", option),
Err(ErrorKind::InvalidArgument { message, .. }) => {
match suggestion {
Some(s) => assert!(message.contains(s)),
None => assert!(!message.contains("similar")),
};
}
Err(e) => panic!("expected InvalidArgument, but got {:?}", e),
}
}

parse_uri("invalidoption", None);
parse_uri("x", None);
parse_uri("max", None);
parse_uri("tlstimeout", None);
parse_uri("waitqueuetimeout", Some("waitqueuetimeoutms"));
parse_uri("retry_reads", Some("retryreads"));
parse_uri("poolsize", Some("maxpoolsize"));
parse_uri("maxstalenessms", Some("maxstalenessseconds"));
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion src/operation/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl OperationWithDefaults for Find {

if options
.batch_size
.map(|batch_size| batch_size > std::i32::MAX as u32)
.map(|batch_size| batch_size > i32::MAX as u32)
== Some(true)
{
return Err(ErrorKind::InvalidArgument {
Expand Down
2 changes: 1 addition & 1 deletion src/serde_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub(crate) fn serialize_u32_option_as_batch_size<S: Serializer>(
) -> std::result::Result<S::Ok, S::Error> {
match val {
#[allow(clippy::cast_possible_wrap)]
Some(val) if *val <= std::i32::MAX as u32 => (doc! {
Some(val) if *val <= i32::MAX as u32 => (doc! {
"batchSize": (*val as i32)
})
.serialize(serializer),
Expand Down