Skip to content

Commit 2075413

Browse files
authored
RUST-1268 Use rustc_version_runtime for runtime metadata (#622) (#624)
1 parent bb9d33f commit 2075413

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ openssl-probe = { version = "0.1.5", optional = true }
6565
os_info = { version = "3.0.1", default-features = false }
6666
percent-encoding = "2.0.0"
6767
rand = { version = "0.8.3", features = ["small_rng"] }
68+
rustc_version_runtime = "0.1.4"
6869
rustls-pemfile = "0.3.0"
6970
serde_with = "1.3.1"
7071
sha-1 = "0.10.0"
@@ -79,7 +80,6 @@ tokio-openssl = { version = "0.6.3", optional = true }
7980
trust-dns-proto = "0.21.1"
8081
trust-dns-resolver = "0.21.1"
8182
typed-builder = "0.10.0"
82-
version_check = "0.9.1"
8383
webpki-roots = "0.22.2"
8484
zstd = { version = "0.11.0", optional = true }
8585

src/cmap/establish/handshake/mod.rs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct ClientMetadata {
3535
application: Option<AppMetadata>,
3636
driver: DriverMetadata,
3737
os: OsMetadata,
38-
platform: Option<String>,
38+
platform: String,
3939
}
4040

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

7676
metadata_doc.insert("os", metadata.os);
77-
78-
if let Some(platform) = metadata.platform {
79-
metadata_doc.insert("platform", platform);
80-
}
77+
metadata_doc.insert("platform", metadata.platform);
8178

8279
Bson::Document(metadata_doc)
8380
}
@@ -118,7 +115,7 @@ lazy_static! {
118115
name: None,
119116
version: None,
120117
},
121-
platform: None,
118+
platform: format!("{} with {}", rustc_version_runtime::version_meta().short_version_string, RUNTIME_NAME),
122119
};
123120

124121
let info = os_info::get();
@@ -131,11 +128,6 @@ lazy_static! {
131128
}
132129
}
133130

134-
if let Some((version, channel, date)) = version_check::triple() {
135-
metadata.platform =
136-
Some(format!("rustc {} {} ({}) with {}", version, channel, date, RUNTIME_NAME));
137-
}
138-
139131
metadata
140132
};
141133
}
@@ -181,11 +173,9 @@ impl Handshaker {
181173
metadata.driver.version.push_str(version);
182174
}
183175

184-
if let Some(ref mut platform) = metadata.platform {
185-
if let Some(ref driver_info_platform) = driver_info.platform {
186-
platform.push('|');
187-
platform.push_str(driver_info_platform);
188-
}
176+
if let Some(ref driver_info_platform) = driver_info.platform {
177+
metadata.platform.push('|');
178+
metadata.platform.push_str(driver_info_platform);
189179
}
190180
}
191181

0 commit comments

Comments
 (0)