Skip to content

Commit 375e147

Browse files
committed
fix: Rename crate_name to pkg_name
1 parent 17d7c83 commit 375e147

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/macros.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/// ```should_panic
66
/// use assert_cmd::Command;
77
///
8-
/// let mut cmd = Command::cargo_bin(assert_cmd::crate_name!()).unwrap();
8+
/// let mut cmd = Command::cargo_bin(assert_cmd::pkg_name!()).unwrap();
99
/// let assert = cmd
1010
/// .arg("-A")
1111
/// .env("stdout", "hello")
@@ -18,6 +18,15 @@
1818
/// .stdout("hello\n");
1919
/// ```
2020
#[macro_export]
21+
macro_rules! pkg_name {
22+
() => {
23+
env!("CARGO_PKG_NAME")
24+
};
25+
}
26+
27+
/// Deprecated, replaced with [`pkg_name`]
28+
#[deprecated(since = "2.1.0", note = "replaced with `pkg_name!`")]
29+
#[macro_export]
2130
macro_rules! crate_name {
2231
() => {
2332
env!("CARGO_PKG_NAME")
@@ -45,7 +54,7 @@ macro_rules! crate_name {
4554
#[doc(hidden)]
4655
macro_rules! cargo_bin {
4756
() => {
48-
$crate::cargo::cargo_bin!($crate::crate_name!())
57+
$crate::cargo::cargo_bin!($crate::pkg_name!())
4958
};
5059
($bin_target_name:expr) => {
5160
::std::path::Path::new(env!(concat!("CARGO_BIN_EXE_", $bin_target_name)))

0 commit comments

Comments
 (0)