@@ -1548,72 +1548,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedBrokenConst {
15481548 }
15491549}
15501550
1551- declare_lint ! {
1552- pub UNNECESSARY_EXTERN_CRATES ,
1553- Allow ,
1554- "suggest removing `extern crate` for the 2018 edition"
1555- }
1556-
1557- pub struct ExternCrate ( /* depth */ u32 ) ;
1558-
1559- impl ExternCrate {
1560- pub fn new ( ) -> Self {
1561- ExternCrate ( 0 )
1562- }
1563- }
1564-
1565- impl LintPass for ExternCrate {
1566- fn get_lints ( & self ) -> LintArray {
1567- lint_array ! ( UNNECESSARY_EXTERN_CRATES )
1568- }
1569- }
1570-
1571- impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for ExternCrate {
1572- fn check_item ( & mut self , cx : & LateContext , it : & hir:: Item ) {
1573- if !cx. tcx . features ( ) . extern_absolute_paths {
1574- return
1575- }
1576- if let hir:: ItemExternCrate ( ref orig) = it. node {
1577- if it. attrs . iter ( ) . any ( |a| a. check_name ( "macro_use" ) ) {
1578- return
1579- }
1580- let mut err = cx. struct_span_lint ( UNNECESSARY_EXTERN_CRATES ,
1581- it. span , "`extern crate` is unnecessary in the new edition" ) ;
1582- if it. vis == hir:: Visibility :: Public || self . 0 > 1 || orig. is_some ( ) {
1583- let pub_ = if it. vis == hir:: Visibility :: Public {
1584- "pub "
1585- } else {
1586- ""
1587- } ;
1588-
1589- let help = format ! ( "use `{}use`" , pub_) ;
1590-
1591- if let Some ( orig) = orig {
1592- err. span_suggestion ( it. span , & help,
1593- format ! ( "{}use {} as {};" , pub_, orig, it. name) ) ;
1594- } else {
1595- err. span_suggestion ( it. span , & help,
1596- format ! ( "{}use {};" , pub_, it. name) ) ;
1597- }
1598- } else {
1599- err. span_suggestion ( it. span , "remove it" , "" . into ( ) ) ;
1600- }
1601-
1602- err. emit ( ) ;
1603- }
1604- }
1605-
1606- fn check_mod ( & mut self , _: & LateContext , _: & hir:: Mod ,
1607- _: Span , _: ast:: NodeId ) {
1608- self . 0 += 1 ;
1609- }
1610-
1611- fn check_mod_post ( & mut self , _: & LateContext , _: & hir:: Mod ,
1612- _: Span , _: ast:: NodeId ) {
1613- self . 0 += 1 ;
1614- }
1615- }
1616-
16171551/// Lint for trait and lifetime bounds that don't depend on type parameters
16181552/// which either do nothing, or stop the item from being used.
16191553pub struct TrivialConstraints ;
0 commit comments