Skip to content

Commit

Permalink
Auto merge of rust-lang#7043 - camsteffen:dead-utils, r=flip1995
Browse files Browse the repository at this point in the history
Remove some dead utils

changelog: none
  • Loading branch information
bors committed Apr 6, 2021
2 parents 6ae0835 + 79d3082 commit bbe1567
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
44 changes: 4 additions & 40 deletions clippy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion clippy_utils/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down

0 comments on commit bbe1567

Please # to comment.