@@ -1202,17 +1202,17 @@ impl LintPass for UnusedImportBraces {
1202
1202
lint_array ! ( UNUSED_IMPORT_BRACES )
1203
1203
}
1204
1204
1205
- fn check_view_item ( & mut self , cx : & Context , view_item : & ast:: ViewItem ) {
1206
- match view_item . node {
1207
- ast:: ViewItemUse ( ref view_path) => {
1205
+ fn check_item ( & mut self , cx : & Context , item : & ast:: Item ) {
1206
+ match item . node {
1207
+ ast:: ItemUse ( ref view_path) => {
1208
1208
match view_path. node {
1209
- ast:: ViewPathList ( _, ref items, _ ) => {
1209
+ ast:: ViewPathList ( _, ref items) => {
1210
1210
if items. len ( ) == 1 {
1211
1211
match items[ 0 ] . node {
1212
1212
ast:: PathListIdent { ref name, ..} => {
1213
1213
let m = format ! ( "braces around {} is unnecessary" ,
1214
1214
token:: get_ident( * name) . get( ) ) ;
1215
- cx. span_lint ( UNUSED_IMPORT_BRACES , view_item . span ,
1215
+ cx. span_lint ( UNUSED_IMPORT_BRACES , item . span ,
1216
1216
& m[ ] ) ;
1217
1217
} ,
1218
1218
_ => ( )
@@ -1709,22 +1709,6 @@ impl LintPass for Stability {
1709
1709
}
1710
1710
}
1711
1711
1712
- fn check_view_item ( & mut self , cx : & Context , item : & ast:: ViewItem ) {
1713
- // compiler-generated `extern crate` statements have a dummy span.
1714
- if item. span == DUMMY_SP { return }
1715
-
1716
- let id = match item. node {
1717
- ast:: ViewItemExternCrate ( _, _, id) => id,
1718
- ast:: ViewItemUse ( ..) => return ,
1719
- } ;
1720
- let cnum = match cx. tcx . sess . cstore . find_extern_mod_stmt_cnum ( id) {
1721
- Some ( cnum) => cnum,
1722
- None => return ,
1723
- } ;
1724
- let id = ast:: DefId { krate : cnum, node : ast:: CRATE_NODE_ID } ;
1725
- self . lint ( cx, id, item. span ) ;
1726
- }
1727
-
1728
1712
fn check_expr ( & mut self , cx : & Context , e : & ast:: Expr ) {
1729
1713
if self . is_internal ( cx, e. span ) { return ; }
1730
1714
@@ -1776,6 +1760,17 @@ impl LintPass for Stability {
1776
1760
if self . is_internal ( cx, item. span ) { return }
1777
1761
1778
1762
match item. node {
1763
+ ast:: ItemExternCrate ( _) => {
1764
+ // compiler-generated `extern crate` items have a dummy span.
1765
+ if item. span == DUMMY_SP { return }
1766
+
1767
+ let cnum = match cx. tcx . sess . cstore . find_extern_mod_stmt_cnum ( item. id ) {
1768
+ Some ( cnum) => cnum,
1769
+ None => return ,
1770
+ } ;
1771
+ let id = ast:: DefId { krate : cnum, node : ast:: CRATE_NODE_ID } ;
1772
+ self . lint ( cx, id, item. span ) ;
1773
+ }
1779
1774
ast:: ItemTrait ( _, _, ref supertraits, _) => {
1780
1775
for t in supertraits. iter ( ) {
1781
1776
if let ast:: TraitTyParamBound ( ref t, _) = * t {
0 commit comments