Merge pull request #1162 from sinkuu/fix1040

Fix #1040
This commit is contained in:
Nick Cameron 2016-09-19 14:35:42 +12:00 committed by GitHub
commit e1d7b8ea01
3 changed files with 26 additions and 0 deletions

View File

@ -342,6 +342,7 @@ impl<'a> FmtVisitor<'a> {
pub fn visit_trait_item(&mut self, ti: &ast::TraitItem) {
if self.visit_attrs(&ti.attrs) {
self.push_rewrite(ti.span, None);
return;
}
@ -385,6 +386,7 @@ impl<'a> FmtVisitor<'a> {
pub fn visit_impl_item(&mut self, ii: &ast::ImplItem) {
if self.visit_attrs(&ii.attrs) {
self.push_rewrite(ii.span, None);
return;
}

18
tests/source/skip.rs Normal file
View File

@ -0,0 +1,18 @@
// Test the skip attribute works
#[rustfmt_skip]
fn foo() { badly; formatted; stuff
; }
#[rustfmt_skip]
trait Foo
{
fn foo(
);
}
impl LateLintPass for UsedUnderscoreBinding {
#[cfg_attr(rustfmt, rustfmt_skip)]
fn check_expr() { // comment
}
}

View File

@ -10,3 +10,9 @@ trait Foo
fn foo(
);
}
impl LateLintPass for UsedUnderscoreBinding {
#[cfg_attr(rustfmt, rustfmt_skip)]
fn check_expr() { // comment
}
}