Skip to content

Commit

Permalink
Stabilize tool lints
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 11, 2018
1 parent 8b45dd7 commit b8654ea
Show file tree
Hide file tree
Showing 205 changed files with 211 additions and 212 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,15 @@ You can add options to your code to `allow`/`warn`/`deny` Clippy lints:

Note: `deny` produces errors instead of warnings.

Note: To use the new `clippy::lint_name` syntax, `#![feature(tool_lints)]` has to be activated
currently. If you want to compile your code with the stable toolchain you can use a `cfg_attr` to
Note: To use the new `clippy::lint_name` syntax, a recent compiler has to be used
currently. If you want to compile your code with the stable toolchain you can use a `cfg_attr` to
activate the `tool_lints` feature:
```rust
#![cfg_attr(feature = "cargo-clippy", feature(tool_lints))]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::lint_name))]
```

For this to work you have to use Clippy on the nightly toolchain: `cargo +nightly clippy`. If you
want to use Clippy with the stable toolchain, you can stick to the old unscoped method to
For this to work you have to use Clippy on the nightly toolchain: `cargo +nightly clippy`. If you
want to use Clippy with the stable toolchain, you can stick to the old unscoped method to
enable/disable Clippy lints until `tool_lints` are stable:
```rust
#![cfg_attr(feature = "cargo-clippy", allow(clippy_lint))]
Expand Down
2 changes: 1 addition & 1 deletion clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]

#![allow(clippy::default_hash_types)]

use itertools::Itertools;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#![allow(unknown_lints, clippy::shadow_reuse, clippy::missing_docs_in_private_items)]
#![recursion_limit = "256"]
#![feature(macro_at_most_once_rep)]
#![feature(tool_lints)]

#![warn(rust_2018_idioms, trivial_casts, trivial_numeric_casts)]
#![feature(crate_visibility_modifier)]
#![feature(try_from)]
Expand Down
2 changes: 1 addition & 1 deletion src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// error-pattern:yummy
#![feature(box_syntax)]
#![feature(rustc_private)]
#![feature(tool_lints)]

#![feature(try_from)]
#![allow(unknown_lints, clippy::missing_docs_in_private_items)]

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// error-pattern:cargo-clippy
#![feature(plugin_registrar)]
#![feature(rustc_private)]
#![feature(tool_lints)]

#![allow(unknown_lints)]
#![allow(clippy::missing_docs_in_private_items)]
#![warn(rust_2018_idioms)]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// error-pattern:yummy
#![feature(box_syntax)]
#![feature(rustc_private)]
#![feature(tool_lints)]

#![allow(unknown_lints, clippy::missing_docs_in_private_items)]

use rustc_tools_util::*;
Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/enum-glob-import-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![deny(clippy::all)]
#![allow(unused_imports)]
Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/ice-1588.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![allow(clippy::all)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/ice-1969.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![allow(clippy::all)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/ice-2499.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![allow(dead_code, clippy::char_lit_as_u8, clippy::needless_bool)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/ice-2760.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![allow(unused_variables, clippy::blacklisted_name,
clippy::needless_pass_by_value, dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/ice-2774.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


use std::collections::HashSet;

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/ice-700.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![deny(clippy::all)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/ice_exacte_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![deny(clippy::all)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/if_same_then_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![deny(clippy::if_same_then_else)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/match_same_arms_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![deny(clippy::match_same_arms)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/mut_mut_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![deny(clippy::mut_mut, clippy::zero_ptr, clippy::cmp_nan)]
#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/needless_borrow_fp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#[deny(clippy::all)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/needless_lifetimes_impl_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![deny(clippy::needless_lifetimes)]
#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/regressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![allow(clippy::blacklisted_name)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/single-match-else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![warn(clippy::single_match_else)]

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/used_underscore_binding_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![allow(clippy::useless_attribute)] //issue #2910

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-toml/toml_trivially_copy/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]

#![allow(clippy::many_single_char_names)]

#[derive(Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/absurd-extreme-comparisons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![warn(clippy::absurd_extreme_comparisons)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#[warn(clippy::approx_constant)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![warn(clippy::integer_arithmetic, clippy::float_arithmetic)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#[allow(dead_code, unused_assignments)]
#[warn(clippy::assign_op_pattern)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/assign_ops2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#[allow(unused_assignments)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![warn(clippy::inline_always, clippy::deprecated_semver)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/bit_masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



const THREE_BITS : i64 = 7;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/blacklisted_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![allow(dead_code, clippy::similar_names, clippy::single_match, clippy::toplevel_ref_arg, unused_mut, unused_variables)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/block_in_if_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![warn(clippy::block_in_if_condition_expr)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/bool_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#[warn(clippy::bool_comparison)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![warn(clippy::nonminimal_bool, clippy::logic_bug)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/borrow_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![deny(clippy::borrowed_box)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/box_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#![warn(clippy::all)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/builtin-type-shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#![warn(clippy::builtin_type_shadow)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/bytecount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#[deny(clippy::naive_bytecount)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]



#[warn(clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_possible_wrap, clippy::cast_lossless)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/cast_alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


//! Test casts for alignment issues
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/cast_lossless_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]


#[warn(clippy::cast_lossless)]
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/cast_lossless_integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.


#![feature(tool_lints)]

#[warn(clippy::cast_lossless)]
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
fn main() {
Expand Down
Loading

0 comments on commit b8654ea

Please sign in to comment.