Drive-by cleanup

Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
varkor 2019-02-15 22:26:05 +00:00
parent 7f3c6d7c04
commit 10602f1dbf
5 changed files with 10 additions and 20 deletions

View File

@ -52,13 +52,13 @@ pub enum Def {
AssociatedExistential(DefId),
PrimTy(hir::PrimTy),
TyParam(DefId),
ConstParam(DefId),
SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
ToolMod, // e.g., `rustfmt` in `#[rustfmt::skip]`
// Value namespace
Fn(DefId),
Const(DefId),
ConstParam(DefId),
Static(DefId, bool /* is_mutbl */),
StructCtor(DefId, CtorKind), // `DefId` refers to `NodeId` of the struct's constructor
VariantCtor(DefId, CtorKind), // `DefId` refers to the enum variant

View File

@ -64,19 +64,6 @@ pub fn is_refutable(&self) -> bool {
}
}
pub fn is_const(&self) -> bool {
match self.node {
PatKind::Path(hir::QPath::TypeRelative(..)) => true,
PatKind::Path(hir::QPath::Resolved(_, ref path)) => {
match path.def {
Def::Const(..) | Def::AssociatedConst(..) => true,
_ => false
}
}
_ => false
}
}
/// Call `f` on every "binding" in a pattern, e.g., on `a` in
/// `match foo() { Some(a) => (), None => () }`
pub fn each_binding<F>(&self, mut f: F)

View File

@ -315,8 +315,11 @@ fn propagate_node(&mut self, node: &Node<'tcx>,
Node::Ty(_) |
Node::MacroDef(_) => {}
_ => {
bug!("found unexpected thingy in worklist: {}",
self.tcx.hir().node_to_string(search_item))
bug!(
"found unexpected node kind in worklist: {} ({:?})",
self.tcx.hir().node_to_string(search_item),
node,
);
}
}
}

View File

@ -1502,7 +1502,7 @@ fn clean(&self, cx: &DocContext) -> GenericParamDef {
};
(name, GenericParamDefKind::Lifetime)
}
hir::GenericParamKind::Type { ref default, synthetic, .. } => {
hir::GenericParamKind::Type { ref default, synthetic } => {
(self.name.ident().name.clean(cx), GenericParamDefKind::Type {
did: cx.tcx.hir().local_def_id(self.id),
bounds: self.bounds.clean(cx),
@ -2577,7 +2577,7 @@ fn clean(&self, cx: &DocContext) -> Type {
let mut j = 0;
let lifetime = generic_args.args.iter().find_map(|arg| {
match arg {
GenericArg::Lifetime(lt) => {
hir::GenericArg::Lifetime(lt) => {
if indices.lifetimes == j {
return Some(lt);
}
@ -2602,7 +2602,7 @@ fn clean(&self, cx: &DocContext) -> Type {
let mut j = 0;
let type_ = generic_args.args.iter().find_map(|arg| {
match arg {
GenericArg::Type(ty) => {
hir::GenericArg::Type(ty) => {
if indices.types == j {
return Some(ty);
}

View File

@ -218,7 +218,7 @@ pub fn generics_to_path_params(&self, generics: ty::Generics) -> hir::GenericArg
name: hir::LifetimeName::Param(name),
}));
}
ty::GenericParamDefKind::Type {..} => {
ty::GenericParamDefKind::Type { .. } => {
args.push(hir::GenericArg::Type(self.ty_param_to_ty(param.clone())));
}
}