diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 31a28c2a0630..478b90551256 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -11,6 +11,7 @@ #![allow(stable_features)] #![feature(iterator_find_map)] #![feature(macro_at_most_once_rep)] +#![feature(tool_attributes)] #![feature(rust_2018_preview)] #![warn(rust_2018_idioms)] @@ -180,7 +181,7 @@ pub fn register_pre_expansion_lints(session: &rustc::session::Session, store: &m store.register_pre_expansion_pass(Some(session), box write::Pass); } -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>) { let conf = match utils::conf::file_from_args(reg.args()) { Ok(file_name) => { diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index db449d7c6a26..61c35dc33b01 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1787,7 +1787,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarUsedAfterLoopVisitor<'a, 'tcx> { /// Return true if the type of expr is one that provides `IntoIterator` impls /// for `&T` and `&mut T`, such as `Vec`. -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn is_ref_iterable_type(cx: &LateContext<'_, '_>, e: &Expr) -> bool { // no walk_ptrs_ty: calling iter() on a reference can make sense because it // will allow further borrows afterwards diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 6bdcd004134e..c12389a0a1f9 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -199,7 +199,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass { } } -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn check_single_match(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: &Expr) { if arms.len() == 2 && arms[0].pats.len() == 1 && arms[0].guard.is_none() && diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index 9a6d3df3088f..45e0795e9d23 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -1955,7 +1955,7 @@ enum Convention { StartsWith(&'static str), } -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] const CONVENTIONS: [(Convention, &[SelfKind]); 6] = [ (Convention::Eq("new"), &[SelfKind::No]), (Convention::StartsWith("as_"), &[SelfKind::Ref, SelfKind::RefMut]), @@ -1965,7 +1965,7 @@ const CONVENTIONS: [(Convention, &[SelfKind]); 6] = [ (Convention::StartsWith("to_"), &[SelfKind::Ref]), ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] const TRAIT_METHODS: [(&str, usize, SelfKind, OutType, &str); 30] = [ ("add", 2, SelfKind::Value, OutType::Any, "std::ops::Add"), ("as_mut", 1, SelfKind::RefMut, OutType::Ref, "std::convert::AsMut"), @@ -1999,7 +1999,7 @@ const TRAIT_METHODS: [(&str, usize, SelfKind, OutType, &str); 30] = [ ("sub", 2, SelfKind::Value, OutType::Any, "std::ops::Sub"), ]; -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] const PATTERN_METHODS: [(&str, usize); 17] = [ ("contains", 1), ("starts_with", 1), diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index eeb131959e9a..f731b3764743 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -158,7 +158,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault { } fn create_new_without_default_suggest_msg(ty: Ty<'_>) -> String { - #[cfg_attr(rustfmt, rustfmt_skip)] + #[rustfmt::skip] format!( "impl Default for {} {{ fn default() -> Self {{ diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index e9688262c2a7..08d10d8e4547 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -89,7 +89,7 @@ struct SimilarNamesLocalVisitor<'a, 'tcx: 'a> { // this list contains lists of names that are allowed to be similar // the assumption is that no name is ever contained in multiple lists. -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] const WHITELIST: &[&[&str]] = &[ &["parsed", "parser"], &["lhs", "rhs"], diff --git a/tests/needless_continue_helpers.rs b/tests/needless_continue_helpers.rs index 588dc741d03c..f608ef1ad021 100644 --- a/tests/needless_continue_helpers.rs +++ b/tests/needless_continue_helpers.rs @@ -1,3 +1,5 @@ +#![feature(tool_attributes)] + // Tests for the various helper functions used by the needless_continue // lint that don't belong in utils. @@ -5,7 +7,7 @@ extern crate clippy_lints; use clippy_lints::needless_continue::{erode_block, erode_from_back, erode_from_front}; #[test] -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn test_erode_from_back() { let input = "\ { @@ -23,7 +25,7 @@ fn test_erode_from_back() { } #[test] -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn test_erode_from_back_no_brace() { let input = "\ let x = 5; @@ -35,7 +37,7 @@ let y = something(); } #[test] -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn test_erode_from_front() { let input = " { @@ -54,7 +56,7 @@ fn test_erode_from_front() { } #[test] -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn test_erode_from_front_no_brace() { let input = " something(); @@ -70,7 +72,7 @@ fn test_erode_from_front_no_brace() { } #[test] -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn test_erode_block() { let input = " diff --git a/tests/trim_multiline.rs b/tests/trim_multiline.rs index d6de36bfca73..a61eee409287 100644 --- a/tests/trim_multiline.rs +++ b/tests/trim_multiline.rs @@ -1,3 +1,5 @@ +#![feature(tool_attributes)] + /// test the multiline-trim function extern crate clippy_lints; @@ -13,7 +15,7 @@ fn test_single_line() { } #[test] -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn test_block() { assert_eq!("\ if x { @@ -38,7 +40,7 @@ if x { } #[test] -#[cfg_attr(rustfmt, rustfmt_skip)] +#[rustfmt::skip] fn test_empty_line() { assert_eq!("\ if x {