-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose cargo package name as CARGO_PKG_NAME #2523
Conversation
r? @wycats (rust_highfive has picked a reviewer for you, use r? to override) |
Thanks! Can you add tests for this as well? |
@alexcrichton Could you please take a look at this? |
@@ -109,12 +109,17 @@ impl<'cfg> Compilation<'cfg> { | |||
} | |||
} | |||
|
|||
let metadata = pkg.manifest().metadata().clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to get cloned here, does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metadata() does not return a reference, so i think it needs to. Please correct me if am wrong. I just started on rust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it doesn't return a reference then you shouldn't need the clone()
as it's not a reference, but if it does a reference you should be able to use the fields through the reference (without cloning).
The parts below can probably be:
metadata.description.as_ref().unwrap_or(&String::new())
…tion and home page are exposed as CARGO_PKG_DESCRIPTION and CARGO_PKG_HOMEPAGE respectively. And add a test case - for CARGO_PKG_NAME, CARGO_PKR_DESCRIPTION, CARGO_HOMEPAGE.
@alexcrichton done. |
expose cargo package name as CARGO_PKG_NAME
☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
#2504 Expose cargo package name as
CARGO_PKG_NAME
, and package description and home page are exposed asCARGO_PKG_DESCRIPTION
andCARGO_PKG_HOMEPAGE
respectively