mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Update to Rust 1.15.0-nightly (1c448574b 2016-11-28)
This commit is contained in:
parent
7be32770b1
commit
1d56087188
14 changed files with 207 additions and 228 deletions
|
@ -44,22 +44,19 @@ 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.ty.node {
|
||||
if let Some(&def::PathResolution { base_def: def, .. }) =
|
||||
cx.tcx.def_map.borrow().get(&f.ty.id) {
|
||||
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 {
|
||||
cx.span_lint(INHERITANCE_INTEGRITY, f.span,
|
||||
"Bare DOM structs should only be used as the first field of a \
|
||||
DOM struct. Consider using JS<T> instead.");
|
||||
}
|
||||
return Some(f.span)
|
||||
if let hir::TyPath(hir::QPath::Resolved(_, ref path)) = f.ty.node {
|
||||
if let def::Def::PrimTy(_) = path.def {
|
||||
return None;
|
||||
}
|
||||
if cx.tcx.has_attr(path.def.def_id(), "_dom_struct_marker") {
|
||||
// If the field is not the first, it's probably
|
||||
// being misused (a)
|
||||
if ctr > 0 {
|
||||
cx.span_lint(INHERITANCE_INTEGRITY, f.span,
|
||||
"Bare DOM structs should only be used as the first field of a \
|
||||
DOM struct. Consider using JS<T> instead.");
|
||||
}
|
||||
return Some(f.span)
|
||||
}
|
||||
}
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue