Skip to content

Commit

Permalink
Qualify uses of MethodContext variants.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Feb 28, 2015
1 parent 48aeaba commit 4dad907
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
//! Use the former for unit-like structs and the latter for structs with
//! a `pub fn new()`.

use self::MethodContext::*;

use metadata::{csearch, decoder};
use middle::def::*;
use middle::subst::Substs;
Expand Down Expand Up @@ -870,22 +868,22 @@ fn method_context(cx: &Context, m: &ast::Method) -> MethodContext {
match md {
ty::MethodTraitItem(md) => {
match md.container {
ty::TraitContainer(..) => TraitDefaultImpl,
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
ty::ImplContainer(cid) => {
match ty::impl_trait_ref(cx.tcx, cid) {
Some(..) => TraitImpl,
None => PlainImpl
Some(..) => MethodContext::TraitImpl,
None => MethodContext::PlainImpl
}
}
}
}
ty::TypeTraitItem(typedef) => {
match typedef.container {
ty::TraitContainer(..) => TraitDefaultImpl,
ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
ty::ImplContainer(cid) => {
match ty::impl_trait_ref(cx.tcx, cid) {
Some(..) => TraitImpl,
None => PlainImpl
Some(..) => MethodContext::TraitImpl,
None => MethodContext::PlainImpl
}
}
}
Expand Down Expand Up @@ -979,9 +977,9 @@ impl LintPass for NonSnakeCase {
_: &ast::Block, span: Span, _: ast::NodeId) {
match fk {
visit::FkMethod(ident, _, m) => match method_context(cx, m) {
PlainImpl
MethodContext::PlainImpl
=> self.check_snake_case(cx, "method", ident, span),
TraitDefaultImpl
MethodContext::TraitDefaultImpl
=> self.check_snake_case(cx, "trait method", ident, span),
_ => (),
},
Expand Down Expand Up @@ -1563,7 +1561,7 @@ impl LintPass for MissingDoc {
_: &ast::Block, _: Span, _: ast::NodeId) {
if let visit::FkMethod(_, _, m) = fk {
// If the method is an impl for a trait, don't doc.
if method_context(cx, m) == TraitImpl { return; }
if method_context(cx, m) == MethodContext::TraitImpl { return; }

// Otherwise, doc according to privacy. This will also check
// doc for default methods defined on traits.
Expand Down

0 comments on commit 4dad907

Please sign in to comment.