From 5c2549482a9974a145e5c45c61d03f9606d5e8a3 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 28 Feb 2017 12:47:48 +0100 Subject: [PATCH 1/3] Get cargo clippy working on 64 bit windows again fixes #1244 --- appveyor.yml | 4 +--- src/main.rs | 43 ++++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 74b659b0b0f..d83d3478c32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,10 +4,8 @@ environment: matrix: - TARGET: i686-pc-windows-gnu MSYS2_BITS: 32 - RUN_CARGO_CLIPPY: true - TARGET: i686-pc-windows-msvc MSYS2_BITS: 32 - RUN_CARGO_CLIPPY: true - TARGET: x86_64-pc-windows-gnu MSYS2_BITS: 64 - TARGET: x86_64-pc-windows-msvc @@ -29,7 +27,7 @@ test_script: - cargo test --features debugging - copy target\debug\cargo-clippy.exe C:\Users\appveyor\.cargo\bin\ - cargo clippy -- -D clippy - - if defined RUN_CARGO_CLIPPY cd clippy_lints && cargo clippy -- -D clippy && cd .. + - cd clippy_lints && cargo clippy -- -D clippy && cd .. notifications: - provider: Email diff --git a/src/main.rs b/src/main.rs index 9d67ba3958a..c7681364f18 100644 --- a/src/main.rs +++ b/src/main.rs @@ -244,30 +244,31 @@ pub fn main() { .expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust") }; - // this conditional check for the --sysroot flag is there so users can call `cargo-clippy` directly - // without having to pass --sysroot or anything - let mut args: Vec = if env::args().any(|s| s == "--sysroot") { - env::args().collect() - } else { - env::args().chain(Some("--sysroot".to_owned())).chain(Some(sys_root)).collect() - }; + rustc_driver::in_rustc_thread(|| { + // this conditional check for the --sysroot flag is there so users can call `cargo-clippy` directly + // without having to pass --sysroot or anything + let mut args: Vec = if env::args().any(|s| s == "--sysroot") { + env::args().collect() + } else { + env::args().chain(Some("--sysroot".to_owned())).chain(Some(sys_root)).collect() + }; - // this check ensures that dependencies are built but not linted and the final crate is - // linted but not built - let clippy_enabled = env::args().any(|s| s == "-Zno-trans"); + // this check ensures that dependencies are built but not linted and the final crate is + // linted but not built + let clippy_enabled = env::args().any(|s| s == "-Zno-trans"); - if clippy_enabled { - args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]); - } - - let mut ccc = ClippyCompilerCalls::new(clippy_enabled); - let (result, _) = rustc_driver::run_compiler(&args, &mut ccc, None, None); - - if let Err(err_count) = result { - if err_count > 0 { - std::process::exit(1); + if clippy_enabled { + args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]); } - } + + let mut ccc = ClippyCompilerCalls::new(clippy_enabled); + let (result, _) = rustc_driver::run_compiler(&args, &mut ccc, None, None); + if let Err(err_count) = result { + if err_count > 0 { + std::process::exit(1); + } + } + }).expect("rustc_thread failed"); } } From e53575b871a3798be6abc49c78d64f2d939768bf Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 28 Feb 2017 14:27:54 +0100 Subject: [PATCH 2/3] Bump the version --- CHANGELOG.md | 3 +++ Cargo.toml | 4 ++-- clippy_lints/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df039102c44..4885986e271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to this project will be documented in this file. +## 0.0.116 — 2017-02-28 +* Fix `cargo clippy` on 64 bit windows systems + ## 0.0.115 — 2017-02-27 * Rustup to *rustc 1.17.0-nightly (60a0edc6c 2017-02-26)* * New lints: [`zero_ptr`], [`never_loop`], [`mut_from_ref`] diff --git a/Cargo.toml b/Cargo.toml index 5fe74d4f663..c71287b0ea8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.115" +version = "0.0.116" authors = [ "Manish Goregaokar ", "Andre Bogus ", @@ -30,7 +30,7 @@ test = false [dependencies] # begin automatic update -clippy_lints = { version = "0.0.115", path = "clippy_lints" } +clippy_lints = { version = "0.0.116", path = "clippy_lints" } # end automatic update cargo_metadata = "0.1.1" diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index 7b545993b65..4c68b94a6fc 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clippy_lints" # begin automatic update -version = "0.0.115" +version = "0.0.116" # end automatic update authors = [ "Manish Goregaokar ", From a78ca9e955d66c7f676482e348c6ba4e89cfc24a Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 28 Feb 2017 14:29:06 +0100 Subject: [PATCH 3/3] Run rustfmt --- src/main.rs | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/main.rs b/src/main.rs index c7681364f18..12dd5d1f695 100644 --- a/src/main.rs +++ b/src/main.rs @@ -245,30 +245,31 @@ pub fn main() { }; rustc_driver::in_rustc_thread(|| { - // this conditional check for the --sysroot flag is there so users can call `cargo-clippy` directly - // without having to pass --sysroot or anything - let mut args: Vec = if env::args().any(|s| s == "--sysroot") { - env::args().collect() - } else { - env::args().chain(Some("--sysroot".to_owned())).chain(Some(sys_root)).collect() - }; + // this conditional check for the --sysroot flag is there so users can call `cargo-clippy` directly + // without having to pass --sysroot or anything + let mut args: Vec = if env::args().any(|s| s == "--sysroot") { + env::args().collect() + } else { + env::args().chain(Some("--sysroot".to_owned())).chain(Some(sys_root)).collect() + }; - // this check ensures that dependencies are built but not linted and the final crate is - // linted but not built - let clippy_enabled = env::args().any(|s| s == "-Zno-trans"); + // this check ensures that dependencies are built but not linted and the final crate is + // linted but not built + let clippy_enabled = env::args().any(|s| s == "-Zno-trans"); - if clippy_enabled { - args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]); - } - - let mut ccc = ClippyCompilerCalls::new(clippy_enabled); - let (result, _) = rustc_driver::run_compiler(&args, &mut ccc, None, None); - if let Err(err_count) = result { - if err_count > 0 { - std::process::exit(1); + if clippy_enabled { + args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]); } - } - }).expect("rustc_thread failed"); + + let mut ccc = ClippyCompilerCalls::new(clippy_enabled); + let (result, _) = rustc_driver::run_compiler(&args, &mut ccc, None, None); + if let Err(err_count) = result { + if err_count > 0 { + std::process::exit(1); + } + } + }) + .expect("rustc_thread failed"); } }