Collapse nested matches in method_context.
This commit is contained in:
parent
f38b83b360
commit
8a7b6b3ee6
1 changed files with 19 additions and 23 deletions
|
|
@ -887,32 +887,28 @@ fn method_context(cx: &Context, m: &ast::Method) -> MethodContext {
|
|||
|
||||
match cx.tcx.impl_or_trait_items.borrow().get(&did).cloned() {
|
||||
None => cx.sess().span_bug(m.span, "missing method descriptor?!"),
|
||||
Some(md) => {
|
||||
match md {
|
||||
ty::MethodTraitItem(md) => {
|
||||
match md.container {
|
||||
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
|
||||
ty::ImplContainer(cid) => {
|
||||
match ty::impl_trait_ref(cx.tcx, cid) {
|
||||
Some(..) => MethodContext::TraitImpl,
|
||||
None => MethodContext::PlainImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ty::TypeTraitItem(typedef) => {
|
||||
match typedef.container {
|
||||
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
|
||||
ty::ImplContainer(cid) => {
|
||||
match ty::impl_trait_ref(cx.tcx, cid) {
|
||||
Some(..) => MethodContext::TraitImpl,
|
||||
None => MethodContext::PlainImpl
|
||||
}
|
||||
}
|
||||
Some(ty::MethodTraitItem(md)) => {
|
||||
match md.container {
|
||||
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
|
||||
ty::ImplContainer(cid) => {
|
||||
match ty::impl_trait_ref(cx.tcx, cid) {
|
||||
Some(..) => MethodContext::TraitImpl,
|
||||
None => MethodContext::PlainImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Some(ty::TypeTraitItem(typedef)) => {
|
||||
match typedef.container {
|
||||
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
|
||||
ty::ImplContainer(cid) => {
|
||||
match ty::impl_trait_ref(cx.tcx, cid) {
|
||||
Some(..) => MethodContext::TraitImpl,
|
||||
None => MethodContext::PlainImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue