Auto merge of #7043 - camsteffen:dead-utils, r=flip1995

Remove some dead utils

changelog: none
This commit is contained in:
bors 2021-04-06 16:49:42 +00:00
commit bbe1567bc9
2 changed files with 4 additions and 41 deletions

View File

@ -60,10 +60,9 @@ use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::{
def, Arm, BindingAnnotation, Block, Body, Constness, CrateItem, Expr, ExprKind, FieldDef, FnDecl, ForeignItem,
GenericArgs, GenericParam, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, LangItem, Lifetime, Local,
MacroDef, MatchSource, Node, Param, Pat, PatKind, Path, PathSegment, QPath, Stmt, TraitItem, TraitItemKind,
TraitRef, TyKind, Variant, Visibility,
def, Arm, BindingAnnotation, Block, Body, Constness, Expr, ExprKind, FnDecl, GenericArgs, HirId, Impl, ImplItem,
ImplItemKind, Item, ItemKind, LangItem, MatchSource, Node, Param, Pat, PatKind, Path, PathSegment, QPath,
TraitItem, TraitItemKind, TraitRef, TyKind,
};
use rustc_lint::{LateContext, Level, Lint, LintContext};
use rustc_middle::hir::exports::Export;
@ -75,7 +74,7 @@ use rustc_session::Session;
use rustc_span::hygiene::{ExpnKind, MacroKind};
use rustc_span::source_map::original_sp;
use rustc_span::sym;
use rustc_span::symbol::{kw, Ident, Symbol};
use rustc_span::symbol::{kw, Symbol};
use rustc_span::{Span, DUMMY_SP};
use rustc_target::abi::Integer;
@ -712,41 +711,6 @@ fn line_span<T: LintContext>(cx: &T, span: Span) -> Span {
Span::new(line_start, span.hi(), span.ctxt())
}
/// Gets the span of the node, if there is one.
pub fn get_node_span(node: Node<'_>) -> Option<Span> {
match node {
Node::Param(Param { span, .. })
| Node::Item(Item { span, .. })
| Node::ForeignItem(ForeignItem { span, .. })
| Node::TraitItem(TraitItem { span, .. })
| Node::ImplItem(ImplItem { span, .. })
| Node::Variant(Variant { span, .. })
| Node::Field(FieldDef { span, .. })
| Node::Expr(Expr { span, .. })
| Node::Stmt(Stmt { span, .. })
| Node::PathSegment(PathSegment {
ident: Ident { span, .. },
..
})
| Node::Ty(hir::Ty { span, .. })
| Node::TraitRef(TraitRef {
path: Path { span, .. },
..
})
| Node::Binding(Pat { span, .. })
| Node::Pat(Pat { span, .. })
| Node::Arm(Arm { span, .. })
| Node::Block(Block { span, .. })
| Node::Local(Local { span, .. })
| Node::MacroDef(MacroDef { span, .. })
| Node::Lifetime(Lifetime { span, .. })
| Node::GenericParam(GenericParam { span, .. })
| Node::Visibility(Visibility { span, .. })
| Node::Crate(CrateItem { span, .. }) => Some(*span),
Node::Ctor(_) | Node::AnonConst(_) => None,
}
}
/// Gets the parent node, if any.
pub fn get_parent_node(tcx: TyCtxt<'_>, id: HirId) -> Option<Node<'_>> {
tcx.hir().parent_iter(id).next().map(|(_, node)| node)

View File

@ -93,7 +93,6 @@ pub(super) const PANIC_ANY: [&str; 3] = ["std", "panic", "panic_any"];
pub const PARKING_LOT_MUTEX_GUARD: [&str; 2] = ["parking_lot", "MutexGuard"];
pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 2] = ["parking_lot", "RwLockReadGuard"];
pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 2] = ["parking_lot", "RwLockWriteGuard"];
pub const PATH_BUF: [&str; 3] = ["std", "path", "PathBuf"];
pub const PATH_BUF_AS_PATH: [&str; 4] = ["std", "path", "PathBuf", "as_path"];
pub const PATH_TO_PATH_BUF: [&str; 4] = ["std", "path", "Path", "to_path_buf"];
pub const PERMISSIONS: [&str; 3] = ["std", "fs", "Permissions"];