提交 10602f1d 编写于 作者: V varkor

Drive-by cleanup

Co-Authored-By: NGabriel Smith <yodaldevoid@users.noreply.github.com>
上级 7f3c6d7c
......@@ -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
......
......@@ -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)
......
......@@ -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,
);
}
}
}
......
......@@ -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);
}
......
......@@ -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())));
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册