mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-30 16:30:47 +08:00
Rust 1.67 was announced[0]. Update the necessary files for running 1.67 and fix the clippy suggestions for string interpolation. [0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
24 lines
655 B
Rust
24 lines
655 B
Rust
use std::process::Command;
|
|
|
|
fn main() {
|
|
// Set a build-time `GIT_HEAD` env var which includes the commit id;
|
|
// such that we can tell which code is running.
|
|
let hash = Command::new("git")
|
|
.arg("rev-parse")
|
|
.arg("--short")
|
|
.arg("HEAD")
|
|
.output()
|
|
.ok()
|
|
.and_then(|output| {
|
|
if output.status.success() {
|
|
String::from_utf8(output.stdout).ok()
|
|
} else {
|
|
None
|
|
}
|
|
})
|
|
.unwrap_or_else(|| String::from("unknown"));
|
|
|
|
println!("cargo:rustc-env=GIT_HEAD={hash}");
|
|
println!("cargo:rustc-rerun-if-changed=.git/HEAD");
|
|
}
|