Skip to content

Commit

Permalink
RUST-1268 Use rustc_version_runtime for runtime metadata (#622) (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmahar authored Apr 13, 2022
1 parent bb9d33f commit 2075413
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ openssl-probe = { version = "0.1.5", optional = true }
os_info = { version = "3.0.1", default-features = false }
percent-encoding = "2.0.0"
rand = { version = "0.8.3", features = ["small_rng"] }
rustc_version_runtime = "0.1.4"
rustls-pemfile = "0.3.0"
serde_with = "1.3.1"
sha-1 = "0.10.0"
Expand All @@ -79,7 +80,6 @@ tokio-openssl = { version = "0.6.3", optional = true }
trust-dns-proto = "0.21.1"
trust-dns-resolver = "0.21.1"
typed-builder = "0.10.0"
version_check = "0.9.1"
webpki-roots = "0.22.2"
zstd = { version = "0.11.0", optional = true }

Expand Down
22 changes: 6 additions & 16 deletions src/cmap/establish/handshake/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct ClientMetadata {
application: Option<AppMetadata>,
driver: DriverMetadata,
os: OsMetadata,
platform: Option<String>,
platform: String,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -74,10 +74,7 @@ impl From<ClientMetadata> for Bson {
);

metadata_doc.insert("os", metadata.os);

if let Some(platform) = metadata.platform {
metadata_doc.insert("platform", platform);
}
metadata_doc.insert("platform", metadata.platform);

Bson::Document(metadata_doc)
}
Expand Down Expand Up @@ -118,7 +115,7 @@ lazy_static! {
name: None,
version: None,
},
platform: None,
platform: format!("{} with {}", rustc_version_runtime::version_meta().short_version_string, RUNTIME_NAME),
};

let info = os_info::get();
Expand All @@ -131,11 +128,6 @@ lazy_static! {
}
}

if let Some((version, channel, date)) = version_check::triple() {
metadata.platform =
Some(format!("rustc {} {} ({}) with {}", version, channel, date, RUNTIME_NAME));
}

metadata
};
}
Expand Down Expand Up @@ -181,11 +173,9 @@ impl Handshaker {
metadata.driver.version.push_str(version);
}

if let Some(ref mut platform) = metadata.platform {
if let Some(ref driver_info_platform) = driver_info.platform {
platform.push('|');
platform.push_str(driver_info_platform);
}
if let Some(ref driver_info_platform) = driver_info.platform {
metadata.platform.push('|');
metadata.platform.push_str(driver_info_platform);
}
}

Expand Down

0 comments on commit 2075413

Please sign in to comment.