Skip to content

Commit

Permalink
Replace cfg_attr(rustfmt... thingies
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed May 30, 2018
1 parent bb2f6a5 commit 8cd2008
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![allow(stable_features)]
#![feature(iterator_find_map)]
#![feature(macro_at_most_once_rep)]
#![feature(tool_attributes)]
#![feature(rust_2018_preview)]

extern crate cargo_metadata;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,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
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,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() &&
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,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]),
Expand All @@ -1831,7 +1831,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"),
Expand Down Expand Up @@ -1865,7 +1865,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),
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/non_expressive_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,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"],
Expand Down
12 changes: 7 additions & 5 deletions tests/needless_continue_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#![feature(tool_attributes)]

// Tests for the various helper functions used by the needless_continue
// lint that don't belong in utils.

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 = "\
{
Expand All @@ -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;
Expand All @@ -35,7 +37,7 @@ let y = something();
}

#[test]
#[cfg_attr(rustfmt, rustfmt_skip)]
#[rustfmt::skip]
fn test_erode_from_front() {
let input = "
{
Expand All @@ -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();
Expand All @@ -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 = "
Expand Down
6 changes: 4 additions & 2 deletions tests/trim_multiline.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![feature(tool_attributes)]

/// test the multiline-trim function
extern crate clippy_lints;

Expand All @@ -13,7 +15,7 @@ fn test_single_line() {
}

#[test]
#[cfg_attr(rustfmt, rustfmt_skip)]
#[rustfmt::skip]
fn test_block() {
assert_eq!("\
if x {
Expand All @@ -38,7 +40,7 @@ if x {
}

#[test]
#[cfg_attr(rustfmt, rustfmt_skip)]
#[rustfmt::skip]
fn test_empty_line() {
assert_eq!("\
if x {
Expand Down

0 comments on commit 8cd2008

Please sign in to comment.