Skip to content

Commit

Permalink
Rollup merge of rust-lang#55930 - ljedrz:hir_bonuses, r=cramertj
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
kennytm committed Nov 15, 2018
2 parents e678f54 + cf4f5c3 commit a24e025
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use syntax_pos::{Span, DUMMY_SP, symbol::InternedString};
use syntax::source_map::{self, Spanned};
use rustc_target::spec::abi::Abi;
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, MetaItem};
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy};
use syntax::attr::InlineAttr;
use syntax::ext::hygiene::SyntaxContext;
use syntax::ptr::P;
Expand Down Expand Up @@ -58,7 +58,6 @@ macro_rules! hir_vec {
($($x:expr),*) => (
$crate::hir::HirVec::from(vec![$($x),*])
);
($($x:expr,)*) => (hir_vec![$($x),*])
}

pub mod check_attr;
Expand Down Expand Up @@ -331,7 +330,7 @@ impl Path {

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

Expand Down Expand Up @@ -698,8 +697,6 @@ pub struct WhereEqPredicate {
pub rhs_ty: P<Ty>,
}

pub type CrateConfig = HirVec<P<MetaItem>>;

/// The top-level data structure that stores the entire contents of
/// the crate currently being compiled.
///
Expand Down Expand Up @@ -1196,8 +1193,8 @@ impl StmtKind {

pub fn id(&self) -> NodeId {
match *self {
StmtKind::Decl(_, id) => id,
StmtKind::Expr(_, id) => id,
StmtKind::Decl(_, id) |
StmtKind::Expr(_, id) |
StmtKind::Semi(_, id) => id,
}
}
Expand Down

0 comments on commit a24e025

Please sign in to comment.