Skip to content
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

Replace cfg_attr(rustfmt... with rustfmt::skip #2823

Merged
merged 1 commit into from
Aug 8, 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
3 changes: 2 additions & 1 deletion 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)]
#![warn(rust_2018_idioms)]

Expand Down Expand Up @@ -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) => {
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 @@ -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
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 @@ -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() &&
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 @@ -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]),
Expand All @@ -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"),
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/new_without_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {{
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 @@ -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"],
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