aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins/lints/inheritance_integrity.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-01-29 02:03:50 +0100
committerMs2ger <ms2ger@gmail.com>2016-02-01 17:55:36 +0100
commit436b952298cfd099267d405941dac7859b02f2d6 (patch)
treec955992fbbcecace2f0f3a3038aa05c5c53391c0 /components/plugins/lints/inheritance_integrity.rs
parente7371b36dd0d3142e65fa54f87e023671c509e35 (diff)
downloadservo-436b952298cfd099267d405941dac7859b02f2d6.tar.gz
servo-436b952298cfd099267d405941dac7859b02f2d6.zip
Bump Rust to 2016-01-31 nightly
Diffstat (limited to 'components/plugins/lints/inheritance_integrity.rs')
-rw-r--r--components/plugins/lints/inheritance_integrity.rs26
1 files changed, 16 insertions, 10 deletions
diff --git a/components/plugins/lints/inheritance_integrity.rs b/components/plugins/lints/inheritance_integrity.rs
index 8ced4fb4c69..fc70920d50e 100644
--- a/components/plugins/lints/inheritance_integrity.rs
+++ b/components/plugins/lints/inheritance_integrity.rs
@@ -46,9 +46,12 @@ impl LateLintPass for InheritancePass {
// 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 Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) =
+ if let Some(&def::PathResolution { base_def: def, .. }) =
cx.tcx.def_map.borrow().get(&f.node.ty.id) {
- if cx.tcx.has_attr(def_id, "_dom_struct_marker") {
+ if let def::Def::PrimTy(_) = def {
+ return None;
+ }
+ if cx.tcx.has_attr(def.def_id(), "_dom_struct_marker") {
// If the field is not the first, it's probably
// being misused (a)
if ctr > 0 {
@@ -66,23 +69,26 @@ impl LateLintPass for InheritancePass {
// We should not have both a reflector and a dom struct field
if let Some(sp) = reflector_span {
if dom_spans.len() > 0 {
- cx.span_lint(INHERITANCE_INTEGRITY, cx.tcx.map.expect_item(id).span,
- "This DOM struct has both Reflector and bare DOM struct members");
+ let mut db = cx.struct_span_lint(INHERITANCE_INTEGRITY,
+ cx.tcx.map.expect_item(id).span,
+ "This DOM struct has both Reflector \
+ and bare DOM struct members");
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
- let sess = cx.sess();
- sess.span_note(sp, "Reflector found here");
+ db.span_note(sp, "Reflector found here");
for span in &dom_spans {
- sess.span_note(*span, "Bare DOM struct found here");
+ db.span_note(*span, "Bare DOM struct found here");
}
}
}
// Nor should we have more than one dom struct field
} else if dom_spans.len() > 1 {
- cx.span_lint(INHERITANCE_INTEGRITY, cx.tcx.map.expect_item(id).span,
- "This DOM struct has multiple DOM struct members, only one is allowed");
+ let mut db = cx.struct_span_lint(INHERITANCE_INTEGRITY,
+ cx.tcx.map.expect_item(id).span,
+ "This DOM struct has multiple \
+ DOM struct members, only one is allowed");
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
for span in &dom_spans {
- cx.sess().span_note(*span, "Bare DOM struct found here");
+ db.span_note(*span, "Bare DOM struct found here");
}
}
} else if dom_spans.is_empty() {