Skip to content

Commit 8a7b6b3

Browse files
committed
Collapse nested matches in method_context.
1 parent f38b83b commit 8a7b6b3

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

src/librustc_lint/builtin.rs

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -887,32 +887,28 @@ fn method_context(cx: &Context, m: &ast::Method) -> MethodContext {
887887

888888
match cx.tcx.impl_or_trait_items.borrow().get(&did).cloned() {
889889
None => cx.sess().span_bug(m.span, "missing method descriptor?!"),
890-
Some(md) => {
891-
match md {
892-
ty::MethodTraitItem(md) => {
893-
match md.container {
894-
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
895-
ty::ImplContainer(cid) => {
896-
match ty::impl_trait_ref(cx.tcx, cid) {
897-
Some(..) => MethodContext::TraitImpl,
898-
None => MethodContext::PlainImpl
899-
}
900-
}
890+
Some(ty::MethodTraitItem(md)) => {
891+
match md.container {
892+
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
893+
ty::ImplContainer(cid) => {
894+
match ty::impl_trait_ref(cx.tcx, cid) {
895+
Some(..) => MethodContext::TraitImpl,
896+
None => MethodContext::PlainImpl
901897
}
902898
}
903-
ty::TypeTraitItem(typedef) => {
904-
match typedef.container {
905-
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
906-
ty::ImplContainer(cid) => {
907-
match ty::impl_trait_ref(cx.tcx, cid) {
908-
Some(..) => MethodContext::TraitImpl,
909-
None => MethodContext::PlainImpl
910-
}
911-
}
899+
}
900+
},
901+
Some(ty::TypeTraitItem(typedef)) => {
902+
match typedef.container {
903+
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
904+
ty::ImplContainer(cid) => {
905+
match ty::impl_trait_ref(cx.tcx, cid) {
906+
Some(..) => MethodContext::TraitImpl,
907+
None => MethodContext::PlainImpl
912908
}
913909
}
914910
}
915-
}
911+
},
916912
}
917913
}
918914

0 commit comments

Comments
 (0)