about summary refs log tree commit diff
path: root/rustc_tools_util
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2018-09-07 18:03:03 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2018-09-07 18:03:03 +0200
commit202db3e09c27eb950abc498a2854b7e8ee7536b6 (patch)
treefcb19ae3bbb6c709ff45e021b304d117adf0806b /rustc_tools_util
parent63a46b1e1a9a4cc3d78e1cf7a628421051c21167 (diff)
downloadrust-202db3e09c27eb950abc498a2854b7e8ee7536b6.tar.gz
rust-202db3e09c27eb950abc498a2854b7e8ee7536b6.zip
rustc_tools_util: don't hardcode crate name
Diffstat (limited to 'rustc_tools_util')
-rw-r--r--rustc_tools_util/src/lib.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/rustc_tools_util/src/lib.rs b/rustc_tools_util/src/lib.rs
index 20b598346f1..b2ec9612290 100644
--- a/rustc_tools_util/src/lib.rs
+++ b/rustc_tools_util/src/lib.rs
@@ -8,6 +8,7 @@ macro_rules! get_version_info {
         let major = env!("CARGO_PKG_VERSION_MAJOR").parse::<u8>().unwrap();
         let minor = env!("CARGO_PKG_VERSION_MINOR").parse::<u8>().unwrap();
         let patch = env!("CARGO_PKG_VERSION_PATCH").parse::<u16>().unwrap();
+        let crate_name = String::from(env!("CARGO_PKG_NAME"));
 
         let host_compiler = $crate::get_channel();
         let commit_hash = option_env!("GIT_HASH").map(|s| s.to_string());
@@ -20,6 +21,7 @@ macro_rules! get_version_info {
             host_compiler,
             commit_hash,
             commit_date,
+            crate_name,
         }
     }};
 }
@@ -32,6 +34,7 @@ pub struct VersionInfo {
     pub host_compiler: Option<String>,
     pub commit_hash: Option<String>,
     pub commit_date: Option<String>,
+    pub crate_name: String,
 }
 
 impl std::fmt::Display for VersionInfo {
@@ -40,7 +43,8 @@ impl std::fmt::Display for VersionInfo {
             Some(_) => {
                 write!(
                     f,
-                    "clippy {}.{}.{} ({} {})",
+                    "{} {}.{}.{} ({} {})",
+                    self.crate_name,
                     self.major,
                     self.minor,
                     self.patch,
@@ -49,7 +53,7 @@ impl std::fmt::Display for VersionInfo {
                 )?;
             },
             None => {
-                write!(f, "clippy {}.{}.{}", self.major, self.minor, self.patch)?;
+                write!(f, "{} {}.{}.{}", self.crate_name, self.major, self.minor, self.patch)?;
             },
         };
         Ok(())