|
28 | 28 | //! Use the former for unit-like structs and the latter for structs with
|
29 | 29 | //! a `pub fn new()`.
|
30 | 30 |
|
31 |
| -use self::MethodContext::*; |
32 |
| - |
33 | 31 | use metadata::{csearch, decoder};
|
34 | 32 | use middle::def::*;
|
35 | 33 | use middle::subst::Substs;
|
@@ -870,22 +868,22 @@ fn method_context(cx: &Context, m: &ast::Method) -> MethodContext {
|
870 | 868 | match md {
|
871 | 869 | ty::MethodTraitItem(md) => {
|
872 | 870 | match md.container {
|
873 |
| - ty::TraitContainer(..) => TraitDefaultImpl, |
| 871 | + ty::TraitContainer(..) => MethodContext::TraitDefaultImpl, |
874 | 872 | ty::ImplContainer(cid) => {
|
875 | 873 | match ty::impl_trait_ref(cx.tcx, cid) {
|
876 |
| - Some(..) => TraitImpl, |
877 |
| - None => PlainImpl |
| 874 | + Some(..) => MethodContext::TraitImpl, |
| 875 | + None => MethodContext::PlainImpl |
878 | 876 | }
|
879 | 877 | }
|
880 | 878 | }
|
881 | 879 | }
|
882 | 880 | ty::TypeTraitItem(typedef) => {
|
883 | 881 | match typedef.container {
|
884 |
| - ty::TraitContainer(..) => TraitDefaultImpl, |
| 882 | + ty::TraitContainer(..) => MethodContext::TraitDefaultImpl, |
885 | 883 | ty::ImplContainer(cid) => {
|
886 | 884 | match ty::impl_trait_ref(cx.tcx, cid) {
|
887 |
| - Some(..) => TraitImpl, |
888 |
| - None => PlainImpl |
| 885 | + Some(..) => MethodContext::TraitImpl, |
| 886 | + None => MethodContext::PlainImpl |
889 | 887 | }
|
890 | 888 | }
|
891 | 889 | }
|
@@ -979,9 +977,9 @@ impl LintPass for NonSnakeCase {
|
979 | 977 | _: &ast::Block, span: Span, _: ast::NodeId) {
|
980 | 978 | match fk {
|
981 | 979 | visit::FkMethod(ident, _, m) => match method_context(cx, m) {
|
982 |
| - PlainImpl |
| 980 | + MethodContext::PlainImpl |
983 | 981 | => self.check_snake_case(cx, "method", ident, span),
|
984 |
| - TraitDefaultImpl |
| 982 | + MethodContext::TraitDefaultImpl |
985 | 983 | => self.check_snake_case(cx, "trait method", ident, span),
|
986 | 984 | _ => (),
|
987 | 985 | },
|
@@ -1563,7 +1561,7 @@ impl LintPass for MissingDoc {
|
1563 | 1561 | _: &ast::Block, _: Span, _: ast::NodeId) {
|
1564 | 1562 | if let visit::FkMethod(_, _, m) = fk {
|
1565 | 1563 | // If the method is an impl for a trait, don't doc.
|
1566 |
| - if method_context(cx, m) == TraitImpl { return; } |
| 1564 | + if method_context(cx, m) == MethodContext::TraitImpl { return; } |
1567 | 1565 |
|
1568 | 1566 | // Otherwise, doc according to privacy. This will also check
|
1569 | 1567 | // doc for default methods defined on traits.
|
|
0 commit comments