@@ -9,7 +9,6 @@ mod type_complexity;
9
9
mod utils;
10
10
mod vec_box;
11
11
12
- use clippy_utils:: is_item_exported;
13
12
use rustc_hir as hir;
14
13
use rustc_hir:: intravisit:: FnKind ;
15
14
use rustc_hir:: {
@@ -310,7 +309,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
310
309
false
311
310
} ;
312
311
313
- let is_exported = is_item_exported ( cx, id . owner ) ;
312
+ let is_exported = cx . access_levels . is_exported ( cx. tcx . hir ( ) . local_def_id ( id ) ) ;
314
313
315
314
self . check_fn_decl (
316
315
cx,
@@ -324,7 +323,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
324
323
}
325
324
326
325
fn check_item ( & mut self , cx : & LateContext < ' tcx > , item : & ' tcx Item < ' _ > ) {
327
- let is_exported = is_item_exported ( cx , item. def_id ) ;
326
+ let is_exported = cx . access_levels . is_exported ( item. def_id ) ;
328
327
329
328
match item. kind {
330
329
ItemKind :: Static ( ty, _, _) | ItemKind :: Const ( ty, _) => self . check_ty (
@@ -356,7 +355,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
356
355
}
357
356
358
357
fn check_field_def ( & mut self , cx : & LateContext < ' _ > , field : & hir:: FieldDef < ' _ > ) {
359
- let is_exported = is_item_exported ( cx, field . hir_id . owner ) && field . vis . node . is_pub ( ) ;
358
+ let is_exported = cx . access_levels . is_exported ( cx. tcx . hir ( ) . local_def_id ( field . hir_id ) ) ;
360
359
361
360
self . check_ty (
362
361
cx,
@@ -368,8 +367,8 @@ impl<'tcx> LateLintPass<'tcx> for Types {
368
367
) ;
369
368
}
370
369
371
- fn check_trait_item ( & mut self , cx : & LateContext < ' _ > , item : & TraitItem < ' _ > ) {
372
- let is_exported = is_item_exported ( cx , item. def_id ) ;
370
+ fn check_trait_item ( & mut self , cx : & LateContext < ' tcx > , item : & TraitItem < ' _ > ) {
371
+ let is_exported = cx . access_levels . is_exported ( item. def_id ) ;
373
372
374
373
let context = CheckTyContext {
375
374
is_exported,
@@ -441,7 +440,7 @@ impl Types {
441
440
let hir_id = hir_ty. hir_id ;
442
441
let res = cx. qpath_res ( qpath, hir_id) ;
443
442
if let Some ( def_id) = res. opt_def_id ( ) {
444
- if self . does_api_allow_change ( context) {
443
+ if self . is_type_change_allowed ( context) {
445
444
// All lints that are being checked in this block are guarded by
446
445
// the `avoid_breaking_exported_api` configuration. When adding a
447
446
// new lint, please also add the name to the configuration documentation
@@ -528,7 +527,7 @@ impl Types {
528
527
529
528
/// This function checks if the type is allowed to change in the current context
530
529
/// based on the `avoid_breaking_exported_api` configuration
531
- fn does_api_allow_change ( & self , context : CheckTyContext ) -> bool {
530
+ fn is_type_change_allowed ( & self , context : CheckTyContext ) -> bool {
532
531
!( context. is_exported && self . avoid_breaking_exported_api )
533
532
}
534
533
}
0 commit comments