Skip to content

Commit e108721

Browse files
committed
hir::hir: simplify some imports
1 parent 3b66f4e commit e108721

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/librustc/hir/hir.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,15 @@
22
//!
33
//! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html
44
5-
pub use self::BlockCheckMode::*;
6-
pub use self::FunctionRetTy::*;
7-
pub use self::PrimTy::*;
8-
pub use self::UnOp::*;
9-
pub use self::UnsafeSource::*;
10-
115
use crate::hir::def::{DefKind, Res};
126
use crate::hir::def_id::DefId;
137
use crate::hir::itemlikevisit;
148
use crate::hir::print;
9+
use rustc_hir::hir_id::HirId;
1510

1611
use errors::FatalError;
1712
use rustc_data_structures::fx::FxHashSet;
1813
use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
19-
use rustc_hir::hir_id::*;
2014
use rustc_macros::HashStable;
2115
use rustc_session::node_id::NodeMap;
2216
use rustc_span::source_map::{SourceMap, Spanned};
@@ -1068,16 +1062,16 @@ pub enum UnOp {
10681062
impl UnOp {
10691063
pub fn as_str(self) -> &'static str {
10701064
match self {
1071-
UnDeref => "*",
1072-
UnNot => "!",
1073-
UnNeg => "-",
1065+
Self::UnDeref => "*",
1066+
Self::UnNot => "!",
1067+
Self::UnNeg => "-",
10741068
}
10751069
}
10761070

10771071
/// Returns `true` if the unary operator takes its argument by value.
10781072
pub fn is_by_value(self) -> bool {
10791073
match self {
1080-
UnNeg | UnNot => true,
1074+
Self::UnNeg | Self::UnNot => true,
10811075
_ => false,
10821076
}
10831077
}
@@ -1387,7 +1381,7 @@ impl Expr<'_> {
13871381
// https://github.com/rust-lang/rfcs/blob/master/text/0803-type-ascription.md#type-ascription-and-temporaries
13881382
ExprKind::Type(ref e, _) => e.is_place_expr(allow_projections_from),
13891383

1390-
ExprKind::Unary(UnDeref, _) => true,
1384+
ExprKind::Unary(UnOp::UnDeref, _) => true,
13911385

13921386
ExprKind::Field(ref base, _) | ExprKind::Index(ref base, _) => {
13931387
allow_projections_from(base) || base.is_place_expr(allow_projections_from)
@@ -2145,17 +2139,17 @@ pub enum FunctionRetTy<'hir> {
21452139
impl fmt::Display for FunctionRetTy<'_> {
21462140
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21472141
match self {
2148-
Return(ref ty) => print::to_string(print::NO_ANN, |s| s.print_type(ty)).fmt(f),
2149-
DefaultReturn(_) => "()".fmt(f),
2142+
Self::Return(ref ty) => print::to_string(print::NO_ANN, |s| s.print_type(ty)).fmt(f),
2143+
Self::DefaultReturn(_) => "()".fmt(f),
21502144
}
21512145
}
21522146
}
21532147

21542148
impl FunctionRetTy<'_> {
21552149
pub fn span(&self) -> Span {
21562150
match *self {
2157-
DefaultReturn(span) => span,
2158-
Return(ref ty) => ty.span,
2151+
Self::DefaultReturn(span) => span,
2152+
Self::Return(ref ty) => ty.span,
21592153
}
21602154
}
21612155
}

0 commit comments

Comments
 (0)