Skip to content

Commit a24e025

Browse files
committed
Rollup merge of rust-lang#55930 - ljedrz:hir_bonuses, r=cramertj
A handful of hir tweaks - remove an unused `hir_vec` macro pattern - simplify `fmt::Debug` for `hir::Path` (take advantage of the `Display` implementation) - remove an unused type alias (`CrateConfig`) - simplify a `match` expression (join common patterns)
2 parents e678f54 + cf4f5c3 commit a24e025

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/librustc/hir/mod.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use syntax_pos::{Span, DUMMY_SP, symbol::InternedString};
2727
use syntax::source_map::{self, Spanned};
2828
use rustc_target::spec::abi::Abi;
2929
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
30-
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, MetaItem};
30+
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy};
3131
use syntax::attr::InlineAttr;
3232
use syntax::ext::hygiene::SyntaxContext;
3333
use syntax::ptr::P;
@@ -58,7 +58,6 @@ macro_rules! hir_vec {
5858
($($x:expr),*) => (
5959
$crate::hir::HirVec::from(vec![$($x),*])
6060
);
61-
($($x:expr,)*) => (hir_vec![$($x),*])
6261
}
6362

6463
pub mod check_attr;
@@ -331,7 +330,7 @@ impl Path {
331330

332331
impl fmt::Debug for Path {
333332
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
334-
write!(f, "path({})", print::to_string(print::NO_ANN, |s| s.print_path(self, false)))
333+
write!(f, "path({})", self)
335334
}
336335
}
337336

@@ -698,8 +697,6 @@ pub struct WhereEqPredicate {
698697
pub rhs_ty: P<Ty>,
699698
}
700699

701-
pub type CrateConfig = HirVec<P<MetaItem>>;
702-
703700
/// The top-level data structure that stores the entire contents of
704701
/// the crate currently being compiled.
705702
///
@@ -1196,8 +1193,8 @@ impl StmtKind {
11961193

11971194
pub fn id(&self) -> NodeId {
11981195
match *self {
1199-
StmtKind::Decl(_, id) => id,
1200-
StmtKind::Expr(_, id) => id,
1196+
StmtKind::Decl(_, id) |
1197+
StmtKind::Expr(_, id) |
12011198
StmtKind::Semi(_, id) => id,
12021199
}
12031200
}

0 commit comments

Comments
 (0)