Skip to content

Commit 0f62101

Browse files
committed
perf(build-rs): Always emit :: directives
Our MSRV is much higher than 1.77. Also, as time goes on, there is less incentive to drop it below 1.77, especially with the MSRV-aware resolver in 1.84
1 parent f9ef2c5 commit 0f62101

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

crates/build-rs/src/allow_use.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
use std::{process::Command, sync::OnceLock};
22

3-
fn rust_version_minor() -> u32 {
4-
static VERSION_MINOR: OnceLock<u32> = OnceLock::new();
5-
*VERSION_MINOR.get_or_init(|| {
6-
version_minor(&crate::input::cargo_pkg_rust_version().unwrap_or_default())
7-
// assume build-rs's MSRV if none specified for the current package
8-
.unwrap_or_else(|| version_minor(env!("CARGO_PKG_RUST_VERSION")).unwrap())
9-
})
10-
}
11-
123
fn cargo_version_minor() -> u32 {
134
static VERSION_MINOR: OnceLock<u32> = OnceLock::new();
145
*VERSION_MINOR.get_or_init(|| {
@@ -33,11 +24,6 @@ fn version_minor(version: &str) -> Option<u32> {
3324
Some(minor)
3425
}
3526

36-
pub(crate) fn double_colon_directives() -> bool {
37-
// cargo errors on `cargo::` directives with insufficient package.rust-version
38-
rust_version_minor() >= 77
39-
}
40-
4127
pub(crate) fn check_cfg() -> bool {
4228
// emit check-cfg if the toolchain being used supports it
4329
cargo_version_minor() >= 80

crates/build-rs/src/output.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ use crate::{
1313
use std::{ffi::OsStr, fmt::Display, fmt::Write, path::Path, str};
1414

1515
fn emit(directive: &str, value: impl Display) {
16-
if allow_use::double_colon_directives() {
17-
println!("cargo::{}={}", directive, value);
18-
} else {
19-
println!("cargo:{}={}", directive, value);
20-
}
16+
println!("cargo::{}={}", directive, value);
2117
}
2218

2319
/// The `rerun-if-changed` instruction tells Cargo to re-run the build script if the
@@ -421,9 +417,5 @@ pub fn metadata(key: &str, val: &str) {
421417
panic!("cannot emit metadata: invalid value {val:?}");
422418
}
423419

424-
if allow_use::double_colon_directives() {
425-
emit("metadata", format_args!("{}={}", key, val));
426-
} else {
427-
emit(key, val);
428-
}
420+
emit("metadata", format_args!("{}={}", key, val));
429421
}

0 commit comments

Comments
 (0)