]> git.lizzy.rs Git - rust.git/blobdiff - src/main.rs
Auto merge of #5864 - rust-lang:ci_debug, r=Manishearth
[rust.git] / src / main.rs
index e299cf4febf2a76c4043230559de9a9aa60b12ae..6739a4cf2245e5e16a7aed73e135edf3d9ab9424 100644 (file)
@@ -1,4 +1,6 @@
 #![cfg_attr(feature = "deny-warnings", deny(warnings))]
+// warn on lints, that are included in `rust-lang/rust`s bootstrap
+#![warn(rust_2018_idioms, unused_lifetimes)]
 
 use rustc_tools_util::VersionInfo;
 use std::env;
@@ -115,7 +117,7 @@ fn path_env(&self) -> &'static str {
         }
     }
 
-    fn path(&self) -> PathBuf {
+    fn path() -> PathBuf {
         let mut path = env::current_exe()
             .expect("current executable path invalid")
             .with_file_name("clippy-driver");
@@ -143,10 +145,10 @@ fn target_dir() -> Option<(&'static str, OsString)> {
             .map(|p| ("CARGO_TARGET_DIR", p))
     }
 
-    fn to_std_cmd(self) -> Command {
+    fn into_std_cmd(self) -> Command {
         let mut cmd = Command::new("cargo");
 
-        cmd.env(self.path_env(), self.path())
+        cmd.env(self.path_env(), Self::path())
             .envs(ClippyCmd::target_dir())
             .env("CLIPPY_ARGS", self.clippy_args)
             .arg(self.cargo_subcommand)
@@ -162,7 +164,7 @@ fn process<I>(old_args: I) -> Result<(), i32>
 {
     let cmd = ClippyCmd::new(old_args);
 
-    let mut cmd = cmd.to_std_cmd();
+    let mut cmd = cmd.into_std_cmd();
 
     let exit_status = cmd
         .spawn()
@@ -179,7 +181,7 @@ fn process<I>(old_args: I) -> Result<(), i32>
 
 #[cfg(test)]
 mod tests {
-    use super::*;
+    use super::ClippyCmd;
 
     #[test]
     #[should_panic]
@@ -196,7 +198,7 @@ fn fix_unstable() {
         let cmd = ClippyCmd::new(args);
         assert_eq!("fix", cmd.cargo_subcommand);
         assert_eq!("RUSTC_WORKSPACE_WRAPPER", cmd.path_env());
-        assert!(cmd.args.iter().find(|arg| arg.ends_with("unstable-options")).is_some());
+        assert!(cmd.args.iter().any(|arg| arg.ends_with("unstable-options")));
     }
 
     #[test]