Skip to content

Stabilize tool lints #3297

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

Merged
merged 2 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#![feature(slice_patterns)]
#![feature(stmt_expr_attributes)]
#![feature(range_contains)]
#![allow(unknown_lints, clippy::shadow_reuse, clippy::missing_docs_in_private_items)]
#![allow(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
4 changes: 2 additions & 2 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// error-pattern:yummy
#![feature(box_syntax)]
#![feature(rustc_private)]
#![feature(tool_lints)]

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

// FIXME: switch to something more ergonomic here, once available.
// (currently there is no way to opt into sysroot crates w/o `extern crate`)
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +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
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// error-pattern:yummy
#![feature(box_syntax)]
#![feature(rustc_private)]
#![feature(tool_lints)]
#![allow(unknown_lints, clippy::missing_docs_in_private_items)]

#![allow(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
Loading