1
Fork 0

Remove all mention and testing of #[plugin(clippy)] and warn if used

This commit is contained in:
Oliver Schneider 2018-05-11 13:20:39 +02:00
parent 654ff18588
commit fd8a1d20cc
No known key found for this signature in database
GPG key ID: 1D5CB4FC597C3004
43 changed files with 39 additions and 122 deletions

View file

@ -151,13 +151,7 @@ Therefore you should use `tests/ui/update-all-references.sh` (after running
Manually testing against an example file is useful if you have added some Manually testing against an example file is useful if you have added some
`println!`s and test suite output becomes unreadable. To try clippy with your `println!`s and test suite output becomes unreadable. To try clippy with your
local modifications, run `cargo run --bin clippy-driver -- -L ./target/debug input.rs` from the local modifications, run `cargo run --bin clippy-driver -- -L ./target/debug input.rs` from the
working copy root. Your test file, here `input.rs`, needs to have clippy working copy root.
enabled as a plugin:
```rust
#![feature(plugin)]
#![plugin(clippy)]
```
### How Clippy works ### How Clippy works

View file

@ -73,7 +73,7 @@ SYSROOT=/path/to/rustc/sysroot cargo install clippy
### Running clippy from the command line without installing it ### Running clippy from the command line without installing it
To have cargo compile your crate with clippy without clippy installation and without needing `#![plugin(clippy)]` To have cargo compile your crate with clippy without clippy installation
in your code, you can use: in your code, you can use:
```terminal ```terminal

View file

@ -14,10 +14,11 @@ extern crate clippy_lints;
pub fn plugin_registrar(reg: &mut Registry) { pub fn plugin_registrar(reg: &mut Registry) {
reg.sess.lint_store.with_read_lock(|lint_store| { reg.sess.lint_store.with_read_lock(|lint_store| {
for (lint, _, _) in lint_store.get_lint_groups() { for (lint, _, _) in lint_store.get_lint_groups() {
reg.sess
.struct_warn("the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature")
.emit();
if lint == "clippy" { if lint == "clippy" {
reg.sess // cargo clippy run on a crate that also uses the plugin
.struct_warn("running cargo clippy on a crate that also imports the clippy plugin")
.emit();
return; return;
} }
} }

View file

@ -1,2 +0,0 @@
#![feature(plugin)]
#![plugin(clippy(conf_file = "./auxiliary/conf_whitelisted.toml"))]

View file

@ -1,6 +1,3 @@
#![feature(plugin)]
#![plugin(clippy)]
#[allow(dead_code)] #[allow(dead_code)]
enum Baz { enum Baz {
One, One,
@ -12,7 +9,9 @@ struct Test {
b: Baz, b: Baz,
} }
fn main() { fn main() { }
pub fn foo() {
use Baz::*; use Baz::*;
let x = Test { t: Some(0), b: One }; let x = Test { t: Some(0), b: One };

View file

@ -1,5 +1,3 @@
#![feature(plugin)]
#![plugin(clippy)]
#![deny(clippy)] #![deny(clippy)]
#[allow(dead_code)] #[allow(dead_code)]
@ -15,3 +13,5 @@ impl Iterator for Foo {
} }
impl ExactSizeIterator for Foo {} impl ExactSizeIterator for Foo {}
fn main() {}

View file

@ -1,5 +1,3 @@
#![feature(plugin)]
#![plugin(clippy)]
#![allow(warnings)] #![allow(warnings)]
// this should compile in a reasonable amount of time // this should compile in a reasonable amount of time

View file

@ -1,12 +1,11 @@
#![feature(plugin)]
#![plugin(clippy)]
#![deny(mut_mut, zero_ptr, cmp_nan)] #![deny(mut_mut, zero_ptr, cmp_nan)]
#![allow(dead_code)] #![allow(dead_code)]
#[macro_use] // compiletest + extern crates doesn't work together
extern crate lazy_static; //#[macro_use]
//extern crate lazy_static;
use std::collections::HashMap; //use std::collections::HashMap;
// ensure that we don't suggest `is_nan` and `is_null` inside constants // ensure that we don't suggest `is_nan` and `is_null` inside constants
// FIXME: once const fn is stable, suggest these functions again in constants // FIXME: once const fn is stable, suggest these functions again in constants
@ -17,6 +16,7 @@ static mut BUH: bool = 42.0 < std::f32::NAN;
#[allow(unused_variables, unused_mut)] #[allow(unused_variables, unused_mut)]
fn main() { fn main() {
/*
lazy_static! { lazy_static! {
static ref MUT_MAP : HashMap<usize, &'static str> = { static ref MUT_MAP : HashMap<usize, &'static str> = {
let mut m = HashMap::new(); let mut m = HashMap::new();
@ -26,6 +26,7 @@ fn main() {
static ref MUT_COUNT : usize = MUT_MAP.len(); static ref MUT_COUNT : usize = MUT_MAP.len();
} }
assert_eq!(*MUT_COUNT, 1); assert_eq!(*MUT_COUNT, 1);
*/
// FIXME: don't lint in array length, requires `check_body` // FIXME: don't lint in array length, requires `check_body`
//let _ = [""; (42.0 < std::f32::NAN) as usize]; //let _ = [""; (42.0 < std::f32::NAN) as usize];
} }

View file

@ -1,5 +1,5 @@
#![feature(plugin)]
#![plugin(clippy)]
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
@ -16,3 +16,5 @@ struct MacroAttributesTest {
fn macro_attributes_test() { fn macro_attributes_test() {
let _ = MacroAttributesTest { _foo: 0 }; let _ = MacroAttributesTest { _foo: 0 };
} }
fn main() {}

View file

@ -0,0 +1 @@
fn main() {}

View file

@ -1,6 +1,6 @@
// error-pattern: error reading Clippy's configuration file // error-pattern: error reading Clippy's configuration file
#![plugin(clippy(conf_file="../ui/conf_bad_toml.toml"))]
fn main() {} fn main() {}

View file

View file

@ -1,6 +1,6 @@
// error-pattern: error reading Clippy's configuration file: `blacklisted-names` is expected to be a `Vec < String >` but is a `integer` // error-pattern: error reading Clippy's configuration file: `blacklisted-names` is expected to be a `Vec < String >` but is a `integer`
#![plugin(clippy(conf_file="../ui/conf_bad_type.toml"))]
fn main() {} fn main() {}

View file

@ -1,6 +0,0 @@
// error-pattern: `conf_file` must be a named value
#![plugin(clippy(conf_file))]
fn main() {}

View file

@ -1,11 +0,0 @@
error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597)
--> $DIR/conf_bad_arg.rs:4:1
|
4 | #![plugin(clippy(conf_file))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(plugin)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,11 +0,0 @@
error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597)
--> $DIR/conf_bad_toml.rs:4:1
|
4 | #![plugin(clippy(conf_file="../ui/conf_bad_toml.toml"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(plugin)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,11 +0,0 @@
error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597)
--> $DIR/conf_bad_type.rs:4:1
|
4 | #![plugin(clippy(conf_file="../ui/conf_bad_type.toml"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(plugin)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,11 +0,0 @@
error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597)
--> $DIR/conf_french_blacklisted_name.rs:2:1
|
2 | #![plugin(clippy(conf_file="../auxiliary/conf_french_blacklisted_name.toml"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(plugin)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,5 +0,0 @@
#![feature(attr_literals)]
#![plugin(clippy(conf_file=42))]
fn main() {}

View file

@ -1,11 +0,0 @@
error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597)
--> $DIR/conf_path_non_string.rs:3:1
|
3 | #![plugin(clippy(conf_file=42))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(plugin)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,11 +0,0 @@
error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597)
--> $DIR/conf_unknown_key.rs:4:1
|
4 | #![plugin(clippy(conf_file="../auxiliary/conf_unknown_key.toml"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(plugin)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,4 +1,4 @@
#![feature(plugin, custom_attribute)] #![feature(custom_attribute)]
#![allow(clippy)] #![allow(clippy)]
#![warn(cyclomatic_complexity)] #![warn(cyclomatic_complexity)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, custom_attribute)] #![feature(custom_attribute)]
#![warn(cyclomatic_complexity)] #![warn(cyclomatic_complexity)]
#![warn(unused)] #![warn(unused)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, never_type)] #![feature(never_type)]
#![warn(diverging_sub_expression)] #![warn(diverging_sub_expression)]
#![allow(match_same_arms, logic_bug)] #![allow(match_same_arms, logic_bug)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, alloc)] #![feature(alloc)]
#![feature(associated_type_defaults)] #![feature(associated_type_defaults)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, non_ascii_idents)] #![feature(non_ascii_idents)]
#![warn(clippy, pub_enum_variant_names)] #![warn(clippy, pub_enum_variant_names)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, box_syntax)] #![feature(box_syntax)]
#![allow(warnings, clippy)] #![allow(warnings, clippy)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, custom_attribute)] #![feature(custom_attribute)]
#![warn(excessive_precision)] #![warn(excessive_precision)]
#![allow(print_literal)] #![allow(print_literal)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, custom_attribute)] #![feature(custom_attribute)]
use std::collections::*; use std::collections::*;

View file

@ -4,8 +4,8 @@
#![allow(unused, no_effect, unnecessary_operation)] #![allow(unused, no_effect, unnecessary_operation)]
#![warn(mut_mut)] #![warn(mut_mut)]
//#![plugin(regex_macros)]
//extern crate regex;
fn fun(x : &mut &mut u32) -> bool { fn fun(x : &mut &mut u32) -> bool {
**x > 0 **x > 0

View file

@ -1,4 +1,4 @@
#![feature(plugin, const_fn)] #![feature(const_fn)]
#![allow(dead_code)] #![allow(dead_code)]

View file

@ -1,4 +1,4 @@
#![feature(plugin, box_syntax)] #![feature(box_syntax)]
#![warn(no_effect, unnecessary_operation)] #![warn(no_effect, unnecessary_operation)]

View file

@ -1,5 +1,5 @@
#![plugin(clippy(conf_file="../auxiliary/conf_french_blacklisted_name.toml"))]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(single_match)] #![allow(single_match)]

View file

@ -1,6 +1,6 @@
// error-pattern: error reading Clippy's configuration file: unknown key `foobar` // error-pattern: error reading Clippy's configuration file: unknown key `foobar`
#![plugin(clippy(conf_file="../auxiliary/conf_unknown_key.toml"))]
fn main() {} fn main() {}

View file

@ -1,4 +1,4 @@
#![feature(plugin, custom_attribute, stmt_expr_attributes)] #![feature(custom_attribute, stmt_expr_attributes)]
#![allow(unused_parens)] #![allow(unused_parens)]