diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index a96193bacf11..5df932a8d93e 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -203,7 +203,7 @@ fn is_relevant_item(tcx: TyCtxt, item: &Item) -> bool { if let ItemFn(_, _, _, _, _, eid) = item.node { is_relevant_expr(tcx, tcx.body_tables(eid), &tcx.hir.body(eid).value) } else { - false + true } } diff --git a/tests/ui/empty_line_after_outer_attribute.rs b/tests/ui/empty_line_after_outer_attribute.rs index 648a25f1dd07..3d62a4913acf 100644 --- a/tests/ui/empty_line_after_outer_attribute.rs +++ b/tests/ui/empty_line_after_outer_attribute.rs @@ -24,6 +24,29 @@ fn with_one_newline() { assert!(true) } fn with_two_newlines() { assert!(true) } + +// This should produce a warning +#[crate_type = "lib"] + +enum Baz { + One, + Two +} + +// This should produce a warning +#[crate_type = "lib"] + +struct Foo { + one: isize, + two: isize +} + +// This should produce a warning +#[crate_type = "lib"] + +mod foo { +} + // This should not produce a warning #[allow(non_camel_case_types)] #[allow(missing_docs)] diff --git a/tests/ui/empty_line_after_outer_attribute.stderr b/tests/ui/empty_line_after_outer_attribute.stderr index 481f95443ce8..7c9c7b8f3495 100644 --- a/tests/ui/empty_line_after_outer_attribute.stderr +++ b/tests/ui/empty_line_after_outer_attribute.stderr @@ -26,5 +26,29 @@ error: Found an empty line after an outer attribute. Perhaps you forgot to add a 25 | | fn with_two_newlines() { assert!(true) } | |_ -error: aborting due to 3 previous errors +error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? + --> $DIR/empty_line_after_outer_attribute.rs:29:1 + | +29 | / #[crate_type = "lib"] +30 | | +31 | | enum Baz { + | |_ + +error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? + --> $DIR/empty_line_after_outer_attribute.rs:37:1 + | +37 | / #[crate_type = "lib"] +38 | | +39 | | struct Foo { + | |_ + +error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? + --> $DIR/empty_line_after_outer_attribute.rs:45:1 + | +45 | / #[crate_type = "lib"] +46 | | +47 | | mod foo { + | |_ + +error: aborting due to 6 previous errors diff --git a/tests/ui/inline_fn_without_body.rs b/tests/ui/inline_fn_without_body.rs index 82e073184d35..76e50e56780c 100644 --- a/tests/ui/inline_fn_without_body.rs +++ b/tests/ui/inline_fn_without_body.rs @@ -11,7 +11,6 @@ trait Foo { #[inline(always)]fn always_inline(); #[inline(never)] - fn never_inline(); #[inline] diff --git a/tests/ui/inline_fn_without_body.stderr b/tests/ui/inline_fn_without_body.stderr index fd26013d11ea..2b466b686103 100644 --- a/tests/ui/inline_fn_without_body.stderr +++ b/tests/ui/inline_fn_without_body.stderr @@ -19,8 +19,7 @@ error: use of `#[inline]` on trait method `never_inline` which has no body | 13 | #[inline(never)] | _____-^^^^^^^^^^^^^^^ -14 | | -15 | | fn never_inline(); +14 | | fn never_inline(); | |____- help: remove error: aborting due to 3 previous errors