about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-11-15 11:04:45 +0100
committerGitHub <noreply@github.com>2018-11-15 11:04:45 +0100
commitc915f921d7267ca701b438e322e78fe04f0e12cd (patch)
tree4f4bbbb48f93c411ae0d3291dfa8e5e1327cead5
parent12556a4b8ff32e84f3024d4c998fee74a1670462 (diff)
parentcf4f5c3b349d994bb2024c700956f043fc913fe6 (diff)
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)
-rw-r--r--src/librustc/hir/mod.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index a2b15f00265..e28193be34a 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -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;
@@ -57,7 +57,6 @@ macro_rules! hir_vec {
     ($($x:expr),*) => (
         $crate::hir::HirVec::from(vec![$($x),*])
     );
-    ($($x:expr,)*) => (hir_vec![$($x),*])
 }
 
 pub mod check_attr;
@@ -318,7 +317,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)
     }
 }
 
@@ -685,8 +684,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.
 ///
@@ -1183,8 +1180,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,
         }
     }