From 6967cf59a4f5664d97086ddccd8cc9b29778d0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 30 Apr 2019 11:10:31 +0200 Subject: [PATCH] clippy-driver: use rustc_tools_util to get version info. This will add git hash information to `clippy-driver -V` output. --- clippy_lints/src/consts.rs | 2 +- src/driver.rs | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 3aa826d8bed..e86e51b7f88 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -344,7 +344,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { } ret }, - // FIXME: cover all useable cases. + // FIXME: cover all usable cases. _ => None, } } diff --git a/src/driver.rs b/src/driver.rs index 834d11861c0..f4a656722b9 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -10,13 +10,11 @@ extern crate rustc_interface; extern crate rustc_plugin; use rustc_interface::interface; +use rustc_tools_util::*; + use std::path::Path; use std::process::{exit, Command}; -fn show_version() { - println!(env!("CARGO_PKG_VERSION")); -} - /// If a command-line option matches `find_arg`, then apply the predicate `pred` on its value. If /// true, then return it. The parameter is assumed to be either `--arg=value` or `--arg value`. fn arg_value<'a>( @@ -117,7 +115,8 @@ pub fn main() { use std::env; if std::env::args().any(|a| a == "--version" || a == "-V") { - show_version(); + let version_info = rustc_tools_util::get_version_info!(); + println!("{}", version_info); exit(0); }