Skip to content

Commit 12f2d61

Browse files
committed
Replace cfg_attr(rustfmt... thingies
1 parent f43d0e5 commit 12f2d61

8 files changed

+20
-15
lines changed

clippy_lints/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#![allow(stable_features)]
1212
#![feature(iterator_find_map)]
1313
#![feature(macro_at_most_once_rep)]
14+
#![feature(tool_attributes)]
1415
#![feature(rust_2018_preview)]
1516
#![warn(rust_2018_idioms)]
1617

@@ -180,7 +181,7 @@ pub fn register_pre_expansion_lints(session: &rustc::session::Session, store: &m
180181
store.register_pre_expansion_pass(Some(session), box write::Pass);
181182
}
182183

183-
#[cfg_attr(rustfmt, rustfmt_skip)]
184+
#[rustfmt::skip]
184185
pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>) {
185186
let conf = match utils::conf::file_from_args(reg.args()) {
186187
Ok(file_name) => {

clippy_lints/src/loops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarUsedAfterLoopVisitor<'a, 'tcx> {
17871787

17881788
/// Return true if the type of expr is one that provides `IntoIterator` impls
17891789
/// for `&T` and `&mut T`, such as `Vec`.
1790-
#[cfg_attr(rustfmt, rustfmt_skip)]
1790+
#[rustfmt::skip]
17911791
fn is_ref_iterable_type(cx: &LateContext<'_, '_>, e: &Expr) -> bool {
17921792
// no walk_ptrs_ty: calling iter() on a reference can make sense because it
17931793
// will allow further borrows afterwards

clippy_lints/src/matches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass {
199199
}
200200
}
201201

202-
#[cfg_attr(rustfmt, rustfmt_skip)]
202+
#[rustfmt::skip]
203203
fn check_single_match(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: &Expr) {
204204
if arms.len() == 2 &&
205205
arms[0].pats.len() == 1 && arms[0].guard.is_none() &&

clippy_lints/src/methods.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ enum Convention {
19551955
StartsWith(&'static str),
19561956
}
19571957

1958-
#[cfg_attr(rustfmt, rustfmt_skip)]
1958+
#[rustfmt::skip]
19591959
const CONVENTIONS: [(Convention, &[SelfKind]); 6] = [
19601960
(Convention::Eq("new"), &[SelfKind::No]),
19611961
(Convention::StartsWith("as_"), &[SelfKind::Ref, SelfKind::RefMut]),
@@ -1965,7 +1965,7 @@ const CONVENTIONS: [(Convention, &[SelfKind]); 6] = [
19651965
(Convention::StartsWith("to_"), &[SelfKind::Ref]),
19661966
];
19671967

1968-
#[cfg_attr(rustfmt, rustfmt_skip)]
1968+
#[rustfmt::skip]
19691969
const TRAIT_METHODS: [(&str, usize, SelfKind, OutType, &str); 30] = [
19701970
("add", 2, SelfKind::Value, OutType::Any, "std::ops::Add"),
19711971
("as_mut", 1, SelfKind::RefMut, OutType::Ref, "std::convert::AsMut"),
@@ -1999,7 +1999,7 @@ const TRAIT_METHODS: [(&str, usize, SelfKind, OutType, &str); 30] = [
19991999
("sub", 2, SelfKind::Value, OutType::Any, "std::ops::Sub"),
20002000
];
20012001

2002-
#[cfg_attr(rustfmt, rustfmt_skip)]
2002+
#[rustfmt::skip]
20032003
const PATTERN_METHODS: [(&str, usize); 17] = [
20042004
("contains", 1),
20052005
("starts_with", 1),

clippy_lints/src/new_without_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
158158
}
159159

160160
fn create_new_without_default_suggest_msg(ty: Ty<'_>) -> String {
161-
#[cfg_attr(rustfmt, rustfmt_skip)]
161+
#[rustfmt::skip]
162162
format!(
163163
"impl Default for {} {{
164164
fn default() -> Self {{

clippy_lints/src/non_expressive_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct SimilarNamesLocalVisitor<'a, 'tcx: 'a> {
8989

9090
// this list contains lists of names that are allowed to be similar
9191
// the assumption is that no name is ever contained in multiple lists.
92-
#[cfg_attr(rustfmt, rustfmt_skip)]
92+
#[rustfmt::skip]
9393
const WHITELIST: &[&[&str]] = &[
9494
&["parsed", "parser"],
9595
&["lhs", "rhs"],

tests/needless_continue_helpers.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
#![feature(tool_attributes)]
2+
13
// Tests for the various helper functions used by the needless_continue
24
// lint that don't belong in utils.
35

46
extern crate clippy_lints;
57
use clippy_lints::needless_continue::{erode_block, erode_from_back, erode_from_front};
68

79
#[test]
8-
#[cfg_attr(rustfmt, rustfmt_skip)]
10+
#[rustfmt::skip]
911
fn test_erode_from_back() {
1012
let input = "\
1113
{
@@ -23,7 +25,7 @@ fn test_erode_from_back() {
2325
}
2426

2527
#[test]
26-
#[cfg_attr(rustfmt, rustfmt_skip)]
28+
#[rustfmt::skip]
2729
fn test_erode_from_back_no_brace() {
2830
let input = "\
2931
let x = 5;
@@ -35,7 +37,7 @@ let y = something();
3537
}
3638

3739
#[test]
38-
#[cfg_attr(rustfmt, rustfmt_skip)]
40+
#[rustfmt::skip]
3941
fn test_erode_from_front() {
4042
let input = "
4143
{
@@ -54,7 +56,7 @@ fn test_erode_from_front() {
5456
}
5557

5658
#[test]
57-
#[cfg_attr(rustfmt, rustfmt_skip)]
59+
#[rustfmt::skip]
5860
fn test_erode_from_front_no_brace() {
5961
let input = "
6062
something();
@@ -70,7 +72,7 @@ fn test_erode_from_front_no_brace() {
7072
}
7173

7274
#[test]
73-
#[cfg_attr(rustfmt, rustfmt_skip)]
75+
#[rustfmt::skip]
7476
fn test_erode_block() {
7577

7678
let input = "

tests/trim_multiline.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(tool_attributes)]
2+
13
/// test the multiline-trim function
24
extern crate clippy_lints;
35

@@ -13,7 +15,7 @@ fn test_single_line() {
1315
}
1416

1517
#[test]
16-
#[cfg_attr(rustfmt, rustfmt_skip)]
18+
#[rustfmt::skip]
1719
fn test_block() {
1820
assert_eq!("\
1921
if x {
@@ -38,7 +40,7 @@ if x {
3840
}
3941

4042
#[test]
41-
#[cfg_attr(rustfmt, rustfmt_skip)]
43+
#[rustfmt::skip]
4244
fn test_empty_line() {
4345
assert_eq!("\
4446
if x {

0 commit comments

Comments
 (0)