@@ -790,21 +790,18 @@ impl LintPass for ImproperCTypes {
790790}
791791
792792impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for ImproperCTypes {
793- fn check_item ( & mut self , cx : & LateContext , it : & hir:: Item ) {
793+ fn check_foreign_item ( & mut self , cx : & LateContext , it : & hir:: ForeignItem ) {
794794 let mut vis = ImproperCTypesVisitor { cx : cx } ;
795- if let hir:: ItemKind :: ForeignMod ( ref nmod) = it. node {
796- if nmod. abi != Abi :: RustIntrinsic && nmod. abi != Abi :: PlatformIntrinsic {
797- for ni in & nmod. items {
798- match ni. node {
799- hir:: ForeignItemKind :: Fn ( ref decl, _, _) => {
800- vis. check_foreign_fn ( ni. id , decl) ;
801- }
802- hir:: ForeignItemKind :: Static ( ref ty, _) => {
803- vis. check_foreign_static ( ni. id , ty. span ) ;
804- }
805- hir:: ForeignItemKind :: Type => ( )
806- }
795+ let abi = cx. tcx . hir . get_foreign_abi ( it. id ) ;
796+ if abi != Abi :: RustIntrinsic && abi != Abi :: PlatformIntrinsic {
797+ match it. node {
798+ hir:: ForeignItemKind :: Fn ( ref decl, _, _) => {
799+ vis. check_foreign_fn ( it. id , decl) ;
800+ }
801+ hir:: ForeignItemKind :: Static ( ref ty, _) => {
802+ vis. check_foreign_static ( it. id , ty. span ) ;
807803 }
804+ hir:: ForeignItemKind :: Type => ( )
808805 }
809806 }
810807 }
0 commit comments