diff options
Diffstat (limited to 'components/plugins/lints')
-rw-r--r-- | components/plugins/lints/inheritance_integrity.rs | 6 | ||||
-rw-r--r-- | components/plugins/lints/privatize.rs | 11 | ||||
-rw-r--r-- | components/plugins/lints/unrooted_must_root.rs | 6 |
3 files changed, 10 insertions, 13 deletions
diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs index fc70920d50e..cc186deb0d9 100644 --- a/components/plugins/lints/inheritance_integrity.rs +++ b/components/plugins/lints/inheritance_integrity.rs @@ -32,7 +32,7 @@ impl LateLintPass for InheritancePass { // Find the reflector, if any let reflector_span = def.fields().iter().enumerate() .find(|&(ctr, f)| { - if match_lang_ty(cx, &*f.node.ty, "reflector") { + if match_lang_ty(cx, &*f.ty, "reflector") { if ctr > 0 { cx.span_lint(INHERITANCE_INTEGRITY, f.span, "The Reflector should be the first field of the DOM \ @@ -45,9 +45,9 @@ impl LateLintPass for InheritancePass { .map(|(_, f)| f.span); // Find all #[dom_struct] fields let dom_spans: Vec<_> = def.fields().iter().enumerate().filter_map(|(ctr, f)| { - if let hir::TyPath(..) = f.node.ty.node { + if let hir::TyPath(..) = f.ty.node { if let Some(&def::PathResolution { base_def: def, .. }) = - cx.tcx.def_map.borrow().get(&f.node.ty.id) { + cx.tcx.def_map.borrow().get(&f.ty.id) { if let def::Def::PrimTy(_) = def { return None; } diff --git a/components/plugins/lints/privatize.rs b/components/plugins/lints/privatize.rs index 704edcdaeda..e02c5b09212 100644 --- a/components/plugins/lints/privatize.rs +++ b/components/plugins/lints/privatize.rs @@ -31,13 +31,10 @@ impl LateLintPass for PrivatizePass { id: ast::NodeId) { if cx.tcx.has_attr(cx.tcx.map.local_def_id(id), "privatize") { for field in def.fields() { - match field.node { - hir::StructField_ { kind: hir::NamedField(name, visibility), .. } if visibility == hir::Public => { - cx.span_lint(PRIVATIZE, field.span, - &format!("Field {} is public where only private fields are allowed", - name)); - } - _ => {} + if field.vis == hir::Public { + cx.span_lint(PRIVATIZE, field.span, + &format!("Field {} is public where only private fields are allowed", + field.name)); } } } diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs index 6c8b32698bd..71cb3b246c0 100644 --- a/components/plugins/lints/unrooted_must_root.rs +++ b/components/plugins/lints/unrooted_must_root.rs @@ -92,7 +92,7 @@ impl LateLintPass for UnrootedPass { }; if item.attrs.iter().all(|a| !a.check_name("must_root")) { for ref field in def.fields() { - if is_unrooted_ty(cx, cx.tcx.node_id_to_type(field.node.id), false) { + if is_unrooted_ty(cx, cx.tcx.node_id_to_type(field.id), false) { cx.span_lint(UNROOTED_MUST_ROOT, field.span, "Type must be rooted, use #[must_root] on the struct definition to propagate") } @@ -107,9 +107,9 @@ impl LateLintPass for UnrootedPass { match var.node.data { hir::VariantData::Tuple(ref vec, _) => { for ty in vec { - cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty.node.id).map(|t| { + cx.tcx.ast_ty_to_ty_cache.borrow().get(&ty.id).map(|t| { if is_unrooted_ty(cx, t, false) { - cx.span_lint(UNROOTED_MUST_ROOT, ty.node.ty.span, + cx.span_lint(UNROOTED_MUST_ROOT, ty.ty.span, "Type must be rooted, use #[must_root] on \ the enum definition to propagate") } |