mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Make lint work on all members of ast::Item_
This commit is contained in:
parent
83909398d2
commit
aade0d563e
5 changed files with 50 additions and 5 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ trait Foo {
|
|||
#[inline(always)]fn always_inline();
|
||||
|
||||
#[inline(never)]
|
||||
|
||||
fn never_inline();
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue