// except according to those terms.
use middle::def;
-use middle::def_id::DefId;
use middle::ty;
use lint::{LateContext, LintContext, LintArray};
use lint::{LintPass, LateLintPass};
}
pub fn method_context(cx: &LateContext, id: ast::NodeId, span: Span) -> MethodLateContext {
- match cx.tcx.impl_or_trait_items.borrow().get(&DefId::local(id)) {
+ let def_id = cx.tcx.map.local_def_id(id);
+ match cx.tcx.impl_or_trait_items.borrow().get(&def_id) {
None => cx.sess().span_bug(span, "missing method descriptor?!"),
Some(item) => match item.container() {
ty::TraitContainer(..) => MethodLateContext::TraitDefaultImpl,
fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) {
if let &hir::PatIdent(_, ref path1, _) = &p.node {
let def = cx.tcx.def_map.borrow().get(&p.id).map(|d| d.full_def());
- if let Some(def::DefLocal(_)) = def {
+ if let Some(def::DefLocal(..)) = def {
self.check_snake_case(cx, "variable", &path1.node.name.as_str(), Some(p.span));
}
}
}
- fn check_struct_def(&mut self, cx: &LateContext, s: &hir::StructDef,
+ fn check_struct_def(&mut self, cx: &LateContext, s: &hir::VariantData,
_: ast::Name, _: &hir::Generics, _: ast::NodeId) {
- for sf in &s.fields {
+ for sf in s.fields() {
if let hir::StructField_ { kind: hir::NamedField(name, _), .. } = sf.node {
self.check_snake_case(cx, "structure field", &name.as_str(),
Some(sf.span));