Skip to content

Use CARGO_PKG_VERSION rather than hard-coded version#9

Merged
nnethercote merged 1 commit intonnethercote:masterfrom
BD103:cargo-pkg-version
Nov 11, 2025
Merged

Use CARGO_PKG_VERSION rather than hard-coded version#9
nnethercote merged 1 commit intonnethercote:masterfrom
BD103:cargo-pkg-version

Conversation

@BD103
Copy link
Copy Markdown
Contributor

@BD103 BD103 commented Nov 11, 2025

Cargo handily makes the version of the crate being compiled available through the CARGO_PKG_VERSION environmental variable! We can use the env!() macro to embed the environmental variable into the constant, avoiding the need to duplicate the version number.

As an aside, thanks for the cool tool! I rediscovered it today after reading your post from 2018 on Ad-Hoc Profiling.

@nnethercote nnethercote merged commit 7ab36c1 into nnethercote:master Nov 11, 2025
3 checks passed
@nnethercote
Copy link
Copy Markdown
Owner

Good change, thanks!

@BD103 BD103 deleted the cargo-pkg-version branch November 12, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants