Files
ngit-grasp/build.rs
DanConwayDev 2a9160836b fix: resolve all fmt and clippy warnings
Main lib (src/):
- Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration)
- Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting)
- Replace .or_insert_with(RelaySyncNeeds::default) with .or_default()
- Replace manual div_ceil implementations with .div_ceil(100)

Test code (tests/):
- Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...))
- Remove needless borrows in fetch_metrics() calls
- Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module

grasp-audit:
- Apply cargo fmt to fix formatting
2025-12-11 16:53:03 +00:00

21 lines
597 B
Rust

use std::process::Command;
fn main() {
// Get the short git commit hash
let output = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output();
if let Ok(output) = output {
if output.status.success() {
let commit = String::from_utf8_lossy(&output.stdout);
let commit = commit.trim();
println!("cargo:rustc-env=GIT_COMMIT_SHORT={}", commit);
}
}
// Re-run if HEAD changes (new commits)
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs/heads/");
}