@@ -7,6 +7,7 @@ use rustc::ty::{self, TyCtxt};
7
7
use semver:: Version ;
8
8
use syntax:: ast:: { Attribute , AttrStyle , Lit , LitKind , MetaItemKind , NestedMetaItem , NestedMetaItemKind } ;
9
9
use syntax:: codemap:: Span ;
10
+ use syntax_pos:: { Pos } ;
10
11
use utils:: { in_macro, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then} ;
11
12
12
13
/// **What it does:** Checks for items annotated with `#[inline(always)]`,
@@ -267,7 +268,7 @@ fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) {
267
268
268
269
if let Some ( snippet) = snippet_opt ( cx, attr_to_item_span) {
269
270
let lines = snippet. split ( '\n' ) . collect :: < Vec < _ > > ( ) ;
270
- if lines. iter ( ) . filter ( |l| l. trim ( ) . is_empty ( ) ) . count ( ) > 1 {
271
+ if lines. iter ( ) . filter ( |l| l. trim ( ) . is_empty ( ) ) . count ( ) > 1 && ! is_hidden_attr ( attr ) {
271
272
span_lint (
272
273
cx,
273
274
EMPTY_LINE_AFTER_OUTER_ATTR ,
@@ -312,6 +313,10 @@ fn check_semver(cx: &LateContext, span: Span, lit: &Lit) {
312
313
) ;
313
314
}
314
315
316
+ fn is_hidden_attr ( attr : & Attribute ) -> bool {
317
+ attr. span . lo ( ) . to_usize ( ) == 0 && attr. span . hi ( ) . to_usize ( ) == 0
318
+ }
319
+
315
320
fn is_word ( nmi : & NestedMetaItem , expected : & str ) -> bool {
316
321
if let NestedMetaItemKind :: MetaItem ( ref mi) = nmi. node {
317
322
mi. is_word ( ) && mi. name ( ) == expected
0 commit comments