]> git.lizzy.rs Git - rust.git/blobdiff - src/main.rs
deps: bump toml from 0.4 to 0.5
[rust.git] / src / main.rs
index 369528f195406ffec193d6983a43df71de70c49a..e0b2bcc7266455766a5ce29556aebf82241f474b 100644 (file)
@@ -1,17 +1,3 @@
-// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern:yummy
-#![feature(box_syntax)]
-#![feature(rustc_private)]
-#![allow(clippy::missing_docs_in_private_items)]
-
 use rustc_tools_util::*;
 
 const CARGO_CLIPPY_HELP: &str = r#"Checks a package to catch common mistakes and improve your Rust code.
@@ -70,10 +56,8 @@ fn process<I>(mut old_args: I) -> Result<(), i32>
 {
     let mut args = vec!["check".to_owned()];
 
-    let mut found_dashes = false;
     for arg in old_args.by_ref() {
-        found_dashes |= arg == "--";
-        if found_dashes {
+        if arg == "--" {
             break;
         }
         args.push(arg);
@@ -91,11 +75,7 @@ fn process<I>(mut old_args: I) -> Result<(), i32>
     let target_dir = std::env::var_os("CLIPPY_DOGFOOD")
         .map(|_| {
             std::env::var_os("CARGO_MANIFEST_DIR").map_or_else(
-                || {
-                    let mut fallback = std::ffi::OsString::new();
-                    fallback.push("clippy_dogfood");
-                    fallback
-                },
+                || std::ffi::OsString::from("clippy_dogfood"),
                 |d| {
                     std::path::PathBuf::from(d)
                         .join("target")
@@ -106,6 +86,12 @@ fn process<I>(mut old_args: I) -> Result<(), i32>
         })
         .map(|p| ("CARGO_TARGET_DIR", p));
 
+    // Run the dogfood tests directly on nightly cargo. This is required due
+    // to a bug in rustup.rs when running cargo on custom toolchains. See issue #3118.
+    if std::env::var_os("CLIPPY_DOGFOOD").is_some() && cfg!(windows) {
+        args.insert(0, "+nightly".to_string());
+    }
+
     let exit_status = std::process::Command::new("cargo")
         .args(&args)
         .env("RUSTC_WRAPPER", path)