Skip to content

Commit 92a23b5

Browse files
committed
Always include details section in version output
This was previously excluded if there was no Git information.
1 parent eef0dee commit 92a23b5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/build.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ pub static CRATE_LONG_VERSION: Lazy<String> =
3030

3131
/// This is a very verbose description of the crate version.
3232
pub static CRATE_VERBOSE_VERSION: Lazy<String> = Lazy::new(|| {
33+
let (commit_hash, commit_date) = GIT
34+
.as_ref()
35+
.map(|git| (git.commit_hash, git.commit_date))
36+
.unwrap_or(("unknown", "unknown"));
3337
let mut v = CRATE_VERSION.clone();
3438
macro_rules! push {
3539
($($arg:tt)*) => {v.push('\n'); v.push_str(&format!($($arg)+))};
3640
}
37-
if let Some(git) = GIT.as_ref() {
38-
push!("");
39-
push!("Details:");
40-
push!(" binary: {}", CRATE_NAME);
41-
push!(" release: {}", CRATE_RELEASE);
42-
push!(" commit-hash: {}", git.commit_hash);
43-
push!(" commit-date: {}", git.commit_date);
44-
push!(" target: {}", env!("TARGET"));
45-
}
46-
push!("");
47-
push!("Compiled with:");
41+
push!("\nDetails:");
42+
push!(" binary: {}", CRATE_NAME);
43+
push!(" release: {}", CRATE_RELEASE);
44+
push!(" commit-hash: {}", commit_hash);
45+
push!(" commit-date: {}", commit_date);
46+
push!(" target: {}", env!("TARGET"));
47+
push!("\nCompiled with:");
4848
push!(" binary: {}", env!("RUSTC_VERSION_BINARY"));
4949
push!(" release: {}", env!("RUSTC_VERSION_RELEASE"));
5050
push!(" commit-hash: {}", env!("RUSTC_VERSION_COMMIT_HASH"));

0 commit comments

Comments
 (0)