@@ -1364,7 +1364,6 @@ impl UnreachablePub {
1364
1364
cx : & LateContext < ' _ > ,
1365
1365
what : & str ,
1366
1366
def_id : LocalDefId ,
1367
- span : Span ,
1368
1367
vis_span : Span ,
1369
1368
exportable : bool ,
1370
1369
) {
@@ -1373,7 +1372,7 @@ impl UnreachablePub {
1373
1372
if vis_span. from_expansion ( ) {
1374
1373
applicability = Applicability :: MaybeIncorrect ;
1375
1374
}
1376
- let def_span = cx. tcx . sess . source_map ( ) . guess_head_span ( span ) ;
1375
+ let def_span = cx. tcx . def_span ( def_id ) ;
1377
1376
cx. struct_span_lint ( UNREACHABLE_PUB , def_span, |lint| {
1378
1377
let mut err = lint. build ( fluent:: lint:: builtin_unreachable_pub) ;
1379
1378
err. set_arg ( "what" , what) ;
@@ -1399,36 +1398,22 @@ impl<'tcx> LateLintPass<'tcx> for UnreachablePub {
1399
1398
if let hir:: ItemKind :: Use ( _, hir:: UseKind :: ListStem ) = & item. kind {
1400
1399
return ;
1401
1400
}
1402
- self . perform_lint ( cx, "item" , item. def_id , item. span , item . vis_span , true ) ;
1401
+ self . perform_lint ( cx, "item" , item. def_id , item. vis_span , true ) ;
1403
1402
}
1404
1403
1405
1404
fn check_foreign_item ( & mut self , cx : & LateContext < ' _ > , foreign_item : & hir:: ForeignItem < ' tcx > ) {
1406
- self . perform_lint (
1407
- cx,
1408
- "item" ,
1409
- foreign_item. def_id ,
1410
- foreign_item. span ,
1411
- foreign_item. vis_span ,
1412
- true ,
1413
- ) ;
1405
+ self . perform_lint ( cx, "item" , foreign_item. def_id , foreign_item. vis_span , true ) ;
1414
1406
}
1415
1407
1416
1408
fn check_field_def ( & mut self , cx : & LateContext < ' _ > , field : & hir:: FieldDef < ' _ > ) {
1417
1409
let def_id = cx. tcx . hir ( ) . local_def_id ( field. hir_id ) ;
1418
- self . perform_lint ( cx, "field" , def_id, field. span , field . vis_span , false ) ;
1410
+ self . perform_lint ( cx, "field" , def_id, field. vis_span , false ) ;
1419
1411
}
1420
1412
1421
1413
fn check_impl_item ( & mut self , cx : & LateContext < ' _ > , impl_item : & hir:: ImplItem < ' _ > ) {
1422
1414
// Only lint inherent impl items.
1423
1415
if cx. tcx . associated_item ( impl_item. def_id ) . trait_item_def_id . is_none ( ) {
1424
- self . perform_lint (
1425
- cx,
1426
- "item" ,
1427
- impl_item. def_id ,
1428
- impl_item. span ,
1429
- impl_item. vis_span ,
1430
- false ,
1431
- ) ;
1416
+ self . perform_lint ( cx, "item" , impl_item. def_id , impl_item. vis_span , false ) ;
1432
1417
}
1433
1418
}
1434
1419
}
0 commit comments