Skip to content

Unable to compile my project with clippy #2704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Sh4pe opened this issue Apr 28, 2018 · 7 comments
Closed

Unable to compile my project with clippy #2704

Sh4pe opened this issue Apr 28, 2018 · 7 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@Sh4pe
Copy link

Sh4pe commented Apr 28, 2018

Preparation

Hi! I'm trying to compile my project with clippy, but it does not work. In order to make my project use clippy, I've

  • added clippy = { version = "*", optional = true } to my [dependencies] section of my Cargo.toml
  • added these lines to my lib.rs
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
  • made sure that I'm using the latest nightly version of everything, for example
% rustc --version
rustc 1.27.0-nightly (686d0ae13 2018-04-27)

Problem

But when I'm trying to compile my project using

cargo +nightly build --features "clippy"

I'm these rather lengthy compile errors.

Is there anything I can do or am I using clippy wrong?

@Techcable
Copy link
Contributor

Clippy appears to be broken on the latest nightly :(

@mozillazg
Copy link

mozillazg commented Apr 29, 2018

+1 for compile failed😢

@phansch
Copy link
Member

phansch commented Apr 29, 2018

Thanks, the past few nightlies have broken clippy every time, unfortunately. Going to take a look at it now.

@phansch
Copy link
Member

phansch commented Apr 29, 2018

Nevermind, this should be fixed with the next clippy release. It's already fixed on master.
You can try installing clippy from master via:

cargo install clippy --git https://github.com/rust-lang-nursery/rust-clippy.git

@oli-obk
Copy link
Contributor

oli-obk commented Apr 29, 2018

I'm arguing that this should be the official way to install clippy. Realeasing crates.io versions is just a lot of effort for little gain and unnecessarily delays the time until ppl can use clippy on the bottleneck of us publishing. Master is usually fixed pretty quickly, the publish can take a few days, especially if a weekend comes in between

@CAD97
Copy link
Contributor

CAD97 commented Apr 30, 2018

If you're building on CI, you should probably also pin the version of rust and clippy so that they don't change without choice from the repository.

For example, what I'm now running on Travis:

env:
matrix:
  include:
  # Clippy/Format
  - rust: nightly-2018-04-28
    env: CLIPPY_VERSION="1742229ebb7843a65c05ee495d8de5366fcc5567"
    install:
    - rustup component add rustfmt-preview || true
    - cargo install clippy --git https://github.com/rust-lang-nursery/rust-clippy.git --rev $CLIPPY_VERSION || true
    script:
    - cargo clippy --all-targets --tests -- -D clippy
    - cargo fmt -- --write-mode=diff

This keeps your build reproducible and outside changes from breaking your build.

@phansch
Copy link
Member

phansch commented Dec 4, 2018

Going to close this issue as Clippy is now available via rustup only.

@phansch phansch closed this as completed Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

6 participants