|
2 | 2 | //!
|
3 | 3 | //! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html
|
4 | 4 |
|
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 |
| - |
11 | 5 | use crate::hir::def::{DefKind, Res};
|
12 | 6 | use crate::hir::def_id::DefId;
|
13 | 7 | use crate::hir::itemlikevisit;
|
14 | 8 | use crate::hir::print;
|
| 9 | +use rustc_hir::hir_id::HirId; |
15 | 10 |
|
16 | 11 | use errors::FatalError;
|
17 | 12 | use rustc_data_structures::fx::FxHashSet;
|
18 | 13 | use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
|
19 |
| -use rustc_hir::hir_id::*; |
20 | 14 | use rustc_macros::HashStable;
|
21 | 15 | use rustc_session::node_id::NodeMap;
|
22 | 16 | use rustc_span::source_map::{SourceMap, Spanned};
|
@@ -1068,16 +1062,16 @@ pub enum UnOp {
|
1068 | 1062 | impl UnOp {
|
1069 | 1063 | pub fn as_str(self) -> &'static str {
|
1070 | 1064 | match self {
|
1071 |
| - UnDeref => "*", |
1072 |
| - UnNot => "!", |
1073 |
| - UnNeg => "-", |
| 1065 | + Self::UnDeref => "*", |
| 1066 | + Self::UnNot => "!", |
| 1067 | + Self::UnNeg => "-", |
1074 | 1068 | }
|
1075 | 1069 | }
|
1076 | 1070 |
|
1077 | 1071 | /// Returns `true` if the unary operator takes its argument by value.
|
1078 | 1072 | pub fn is_by_value(self) -> bool {
|
1079 | 1073 | match self {
|
1080 |
| - UnNeg | UnNot => true, |
| 1074 | + Self::UnNeg | Self::UnNot => true, |
1081 | 1075 | _ => false,
|
1082 | 1076 | }
|
1083 | 1077 | }
|
@@ -1387,7 +1381,7 @@ impl Expr<'_> {
|
1387 | 1381 | // https://github.com/rust-lang/rfcs/blob/master/text/0803-type-ascription.md#type-ascription-and-temporaries
|
1388 | 1382 | ExprKind::Type(ref e, _) => e.is_place_expr(allow_projections_from),
|
1389 | 1383 |
|
1390 |
| - ExprKind::Unary(UnDeref, _) => true, |
| 1384 | + ExprKind::Unary(UnOp::UnDeref, _) => true, |
1391 | 1385 |
|
1392 | 1386 | ExprKind::Field(ref base, _) | ExprKind::Index(ref base, _) => {
|
1393 | 1387 | allow_projections_from(base) || base.is_place_expr(allow_projections_from)
|
@@ -2145,17 +2139,17 @@ pub enum FunctionRetTy<'hir> {
|
2145 | 2139 | impl fmt::Display for FunctionRetTy<'_> {
|
2146 | 2140 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
2147 | 2141 | 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), |
2150 | 2144 | }
|
2151 | 2145 | }
|
2152 | 2146 | }
|
2153 | 2147 |
|
2154 | 2148 | impl FunctionRetTy<'_> {
|
2155 | 2149 | pub fn span(&self) -> Span {
|
2156 | 2150 | match *self {
|
2157 |
| - DefaultReturn(span) => span, |
2158 |
| - Return(ref ty) => ty.span, |
| 2151 | + Self::DefaultReturn(span) => span, |
| 2152 | + Self::Return(ref ty) => ty.span, |
2159 | 2153 | }
|
2160 | 2154 | }
|
2161 | 2155 | }
|
|
0 commit comments