Skip to content

Commit c915f92

Browse files
authored
Rollup merge of #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 12556a4 + cf4f5c3 commit c915f92

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Diff for: 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;
@@ -57,7 +57,6 @@ macro_rules! hir_vec {
5757
($($x:expr),*) => (
5858
$crate::hir::HirVec::from(vec![$($x),*])
5959
);
60-
($($x:expr,)*) => (hir_vec![$($x),*])
6160
}
6261

6362
pub mod check_attr;
@@ -318,7 +317,7 @@ impl Path {
318317

319318
impl fmt::Debug for Path {
320319
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
321-
write!(f, "path({})", print::to_string(print::NO_ANN, |s| s.print_path(self, false)))
320+
write!(f, "path({})", self)
322321
}
323322
}
324323

@@ -685,8 +684,6 @@ pub struct WhereEqPredicate {
685684
pub rhs_ty: P<Ty>,
686685
}
687686

688-
pub type CrateConfig = HirVec<P<MetaItem>>;
689-
690687
/// The top-level data structure that stores the entire contents of
691688
/// the crate currently being compiled.
692689
///
@@ -1183,8 +1180,8 @@ impl StmtKind {
11831180

11841181
pub fn id(&self) -> NodeId {
11851182
match *self {
1186-
StmtKind::Decl(_, id) => id,
1187-
StmtKind::Expr(_, id) => id,
1183+
StmtKind::Decl(_, id) |
1184+
StmtKind::Expr(_, id) |
11881185
StmtKind::Semi(_, id) => id,
11891186
}
11901187
}

0 commit comments

Comments
 (0)