Remove uses of span_if_local.

This commit is contained in:
Eduard-Mihai Burtescu 2017-06-11 06:15:53 +03:00
parent e073dfe9a2
commit e4ca0e515f
2 changed files with 6 additions and 8 deletions

View File

@ -514,13 +514,11 @@ fn in_attributes_expansion(expr: &Expr) -> bool {
/// Test whether `def` is a variable defined outside a macro.
fn non_macro_local(cx: &LateContext, def: &def::Def) -> bool {
match *def {
def::Def::Local(id) |
def::Def::Upvar(id, _, _) => {
if let Some(span) = cx.tcx.hir.span_if_local(id) {
!in_macro(span)
} else {
true
}
def::Def::Local(def_id) |
def::Def::Upvar(def_id, _, _) => {
let id = cx.tcx.hir.as_local_node_id(def_id)
.expect("local variables should be found in the same crate");
!in_macro(cx.tcx.hir.span(id))
},
_ => false,
}

View File

@ -159,7 +159,7 @@ fn can_derive_default<'t, 'c>(ty: Ty<'t>, cx: &LateContext<'c, 't>, default_trai
return None;
}
}
cx.tcx.hir.span_if_local(adt_def.did)
Some(cx.tcx.def_span(adt_def.did))
},
_ => None,
}