rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.38k stars 1.53k forks source link

`cargo clippy` does not process build scripts #2802

Open FaultyRAM opened 6 years ago

FaultyRAM commented 6 years ago

cargo clippy doesn't do any extra handling of build scripts beyond what cargo check does. For example, this code will trigger an unknown_lints warning when using cargo clippy:

#![forbid(print_literal)]

fn main() {
    println!("{}", "");
}

Built-in lints still work; adding a #![forbid(missing_docs)] to the above snippet fails the build as expected. clippy-as-a-plugin also works:

#![feature(plugin)]
#![plugin(clippy)]
#![forbid(print_literal)]

fn main() {
    println!("{}", "");
}

I'm not actually sure whether clippy or cargo is at fault here, but since the plugin interface is about to go I figured it might be more prudent to report here first.

flip1995 commented 6 years ago

I'm currently working on tool_lints (rust-lang/rust#44690), which will allow to just write #![forbid(clippy::print_literal)]. This should solve this problem.

lopopolo commented 5 years ago

@flip1995 I noticed this issue has no tags. Does that mean it is not prioritized?

Manishearth commented 5 years ago

No. Not all issues fit cleanly in the labeled buckets.

This in particular is something that would require https://github.com/rust-lang/rust-clippy/issues/3837 to be finished