Update uses of rustfmt_skip to rustfmt::skip

This commit is contained in:
Nick Cameron 2018-05-14 16:25:10 +12:00
parent de950c2973
commit 51f566062f
29 changed files with 55 additions and 58 deletions

View file

@ -1951,7 +1951,7 @@ lines are found, they are trimmed down to match this integer.
Original Code:
```rust
#![rustfmt_skip]
#![rustfmt::skip]
fn foo() {
println!("a");
@ -2010,7 +2010,7 @@ them, additional blank lines are inserted.
Original Code (rustfmt will not change it with the default value of `0`):
```rust
#![rustfmt_skip]
#![rustfmt::skip]
fn foo() {
println!("a");

View file

@ -1253,7 +1253,7 @@ mod test {
}
#[test]
#[cfg_attr(rustfmt, rustfmt_skip)]
#[rustfmt::skip]
fn format_comments() {
let mut config: ::config::Config = Default::default();
config.set().wrap_comments(true);

View file

@ -8,12 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(custom_attribute)]
#![feature(tool_attributes)]
#![feature(decl_macro)]
// FIXME(cramertj) remove after match_default_bindings merges
#![allow(stable_features)]
#![allow(unused_attributes)]
#![feature(match_default_bindings)]
#![feature(type_ascription)]
#![feature(unicode_internals)]
@ -396,7 +393,7 @@ where
Ok((result, has_diff))
}
/// Returns true if the line with the given line number was skipped by `#[rustfmt_skip]`.
/// Returns true if the line with the given line number was skipped by `#[rustfmt::skip]`.
fn is_skipped_line(line_number: usize, skipped_range: &[(usize, usize)]) -> bool {
skipped_range
.iter()
@ -975,7 +972,7 @@ mod unit_tests {
#[test]
fn test_format_code_block_fail() {
#[rustfmt_skip]
#[rustfmt::skip]
let code_block = "this_line_is_100_characters_long_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(x, y, z);";
assert!(format_code_block(code_block, &Config::default()).is_none());
}

View file

@ -704,14 +704,14 @@ impl ConfigCodeBlock {
// We never expect to not have a code block.
assert!(self.code_block.is_some() && self.code_block_start.is_some());
// See if code block begins with #![rustfmt_skip].
// See if code block begins with #![rustfmt::skip].
let fmt_skip = self
.code_block
.as_ref()
.unwrap()
.split('\n')
.nth(0)
.unwrap_or("") == "#![rustfmt_skip]";
.unwrap_or("") == "#![rustfmt::skip]";
if self.config_name.is_none() && !fmt_skip {
write_message(&format!(
@ -790,7 +790,7 @@ impl ConfigCodeBlock {
// - Rust code blocks are identifed by lines beginning with "```rust".
// - One explicit configuration setting is supported per code block.
// - Rust code blocks with no configuration setting are illegal and cause an
// assertion failure, unless the snippet begins with #![rustfmt_skip].
// assertion failure, unless the snippet begins with #![rustfmt::skip].
// - Configuration names in Configurations.md must be in the form of
// "## `NAME`".
// - Configuration values in Configurations.md must be in the form of

View file

@ -1 +1 @@
skip_children = true
skip_children = true

View file

@ -48,5 +48,5 @@ fn debug_function() {
#[link_section=".vectors"]
#[no_mangle] // Test this attribute is preserved.
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
pub static ISSUE_1284: [i32; 16] = [];

View file

@ -36,7 +36,7 @@ fn main() {
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
@ -166,7 +166,7 @@ struct Palette { /// A map of indices in the palette to a count of pixels in app
// when the field had attributes
struct FieldsWithAttributes {
// Pre Comment
#[rustfmt_skip] pub host:String, // Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB
#[rustfmt::skip] pub host:String, // Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB
//Another pre comment
#[attr1]
#[attr2] pub id: usize // CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCC CCCCCCCCCCCC

View file

@ -13,7 +13,7 @@ fn main() {
y: y,
#[attr]
z: z,
#[rustfmt_skip]
#[rustfmt::skip]
skipped: skipped,
};
}

View file

@ -13,7 +13,7 @@ fn main() {
y: y,
#[attr]
z: z,
#[rustfmt_skip]
#[rustfmt::skip]
skipped: skipped,
};
}

View file

@ -49,7 +49,7 @@ pub enum EnumWithAttributes {
//This is a pre comment AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
TupleVar(usize, usize, usize), // AAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// Pre Comment
#[rustfmt_skip]
#[rustfmt::skip]
SkippedItem(String,String,), // Post-comment
#[another_attr]
#[attr2]

View file

@ -13,4 +13,4 @@ use y;
use x;
use a;
use a;

View file

@ -48,7 +48,7 @@ fn foo() {
#[an_attribute]
// Comment after an attribute.
None => 0,
#[rustfmt_skip]
#[rustfmt::skip]
Blurb => { }
};
}
@ -103,7 +103,7 @@ fn matches() {
fn match_skip() {
let _ = match Some(1) {
#[rustfmt_skip]
#[rustfmt::skip]
Some( n ) => n,
None => 1,
};

View file

@ -36,7 +36,7 @@ fn baz<'a: 'b /* comment on 'a */, T: Somsssssssssssssssssssssssssssssssssssssss
#[attr2]#[attr3]extern crate foo;
}
#[rustfmt_skip]
#[rustfmt::skip]
fn qux(a: dadsfa, // Comment 1
b: sdfasdfa, // Comment 2
c: dsfdsafa) // Comment 3
@ -78,7 +78,7 @@ pub trait GraphWalk<'a, N, E> {
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f : SomeType, // Comment beside a field
// Comment on a field
@ -126,7 +126,7 @@ fn deconstruct(foo: Bar) -> (SocketAddr, Method, Headers,
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) {
}
#[rustfmt_skip]
#[rustfmt::skip]
mod a{
fn foo(x: T) {
let x: T = dfasdf;

View file

@ -4,7 +4,7 @@
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
@ -139,7 +139,7 @@ struct Palette { /// A map of indices in the palette to a count of pixels in app
// when the field had attributes
struct FieldsWithAttributes {
// Pre Comment
#[rustfmt_skip] pub host:String, // Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB
#[rustfmt::skip] pub host:String, // Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB
//Another pre comment
#[attr1]
#[attr2] pub id: usize // CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCC CCCCCCCCCCCC

View file

@ -89,7 +89,7 @@ trait AAAAAAAAAAAAAAAAAAA = BBBBBBBBBBBBBBBBBBB + CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
trait AAAAAAAAAAAAAAAAAA = BBBBBBBBBBBBBBBBBBB + CCCCCCCCCCCCCCCCCCCCCCCCCCCCC + DDDDDDDDDDDDDDDDDDD;
trait AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA<A, B, C, D, E> = FooBar;
trait AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA<A, B, C, D, E> = FooBar;
#[rustfmt_skip]
#[rustfmt::skip]
trait FooBar = Foo
+ Bar;

View file

@ -4,7 +4,7 @@
/// A Doc comment
#[AnAttribute]
pub union Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
@ -100,7 +100,7 @@ union Palette { /// A map of indices in the palette to a count of pixels in appr
// when the field had attributes
union FieldsWithAttributes {
// Pre Comment
#[rustfmt_skip] pub host:String, // Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB
#[rustfmt::skip] pub host:String, // Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB
//Another pre comment
#[attr1]
#[attr2] pub id: usize // CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCC CCCCCCCCCCCC

View file

@ -47,5 +47,5 @@ fn debug_function() {
#[link_section=".vectors"]
#[no_mangle] // Test this attribute is preserved.
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
pub static ISSUE_1284: [i32; 16] = [];

View file

@ -36,7 +36,7 @@ fn main() {
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
@ -171,8 +171,8 @@ struct Palette {
// when the field had attributes
struct FieldsWithAttributes {
// Pre Comment
#[rustfmt_skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
* BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
#[rustfmt::skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
* BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
// Another pre comment
#[attr1]
#[attr2]

View file

@ -9,7 +9,7 @@ fn main() {
y: y,
#[attr]
z: z,
#[rustfmt_skip]
#[rustfmt::skip]
skipped: skipped,
};
}

View file

@ -9,7 +9,7 @@ fn main() {
y,
#[attr]
z,
#[rustfmt_skip]
#[rustfmt::skip]
skipped: skipped,
};
}

View file

@ -65,7 +65,7 @@ pub enum EnumWithAttributes {
TupleVar(usize, usize, usize), /* AAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
// Pre Comment
#[rustfmt_skip]
#[rustfmt::skip]
SkippedItem(String,String,), // Post-comment
#[another_attr]
#[attr2]

View file

@ -92,7 +92,7 @@ fn inner() {
x
}
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
fn foo(a: i32) -> i32 {
// comment
if a > 0 { 1 } else { 2 }

View file

@ -51,7 +51,7 @@ fn foo() {
#[an_attribute]
// Comment after an attribute.
None => 0,
#[rustfmt_skip]
#[rustfmt::skip]
Blurb => { }
};
}
@ -109,7 +109,7 @@ fn matches() {
fn match_skip() {
let _ = match Some(1) {
#[rustfmt_skip]
#[rustfmt::skip]
Some( n ) => n,
None => 1,
};

View file

@ -58,7 +58,7 @@ fn baz<
extern crate foo;
}
#[rustfmt_skip]
#[rustfmt::skip]
fn qux(a: dadsfa, // Comment 1
b: sdfasdfa, // Comment 2
c: dsfdsafa) // Comment 3
@ -103,7 +103,7 @@ pub trait GraphWalk<'a, N, E> {
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
@ -172,7 +172,7 @@ fn deconstruct(
) {
}
#[rustfmt_skip]
#[rustfmt::skip]
mod a{
fn foo(x: T) {
let x: T = dfasdf;

View file

@ -12,13 +12,13 @@ fn foo(
}
impl LateLintPass for UsedUnderscoreBinding {
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
fn check_expr() { // comment
}
}
fn issue1346() {
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
Box::new(self.inner.call(req).then(move |result| {
match result {
Ok(resp) => Box::new(future::done(Ok(resp))),
@ -46,7 +46,7 @@ fn skip_on_statements() {
}
// Semi
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
foo(
1, 2, 3, 4,
1, 2,
@ -54,15 +54,15 @@ fn skip_on_statements() {
);
// Local
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
let x = foo( a, b , c);
// Item
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
use foobar;
// Mac
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
vec![
1, 2, 3, 4,
1, 2, 3, 4,
@ -74,7 +74,7 @@ fn skip_on_statements() {
];
// Expr
#[cfg_attr(rustfmt, rustfmt_skip)]
#[cfg_attr(rustfmt, rustfmt::skip)]
foo( a, b , c)
}

View file

@ -1,3 +1,3 @@
#![rustfmt_skip]
#![rustfmt::skip]
use a :: b
;

View file

@ -4,7 +4,7 @@
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
@ -144,8 +144,8 @@ struct Palette {
// when the field had attributes
struct FieldsWithAttributes {
// Pre Comment
#[rustfmt_skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
* BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
#[rustfmt::skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
* BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
// Another pre comment
#[attr1]
#[attr2]

View file

@ -127,7 +127,7 @@ trait AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
D,
E,
> = FooBar;
#[rustfmt_skip]
#[rustfmt::skip]
trait FooBar = Foo
+ Bar;

View file

@ -4,7 +4,7 @@
/// A Doc comment
#[AnAttribute]
pub union Foo {
#[rustfmt_skip]
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
@ -100,8 +100,8 @@ union Palette {
// when the field had attributes
union FieldsWithAttributes {
// Pre Comment
#[rustfmt_skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
* BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
#[rustfmt::skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
* BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
// Another pre comment
#[attr1]
#[attr2]