pacify the merciless x.py fmt
This commit is contained in:
parent
c35801e160
commit
011215b2c7
2 changed files with 11 additions and 47 deletions
|
@ -306,11 +306,7 @@ impl Span {
|
||||||
|
|
||||||
/// Returns `self` if `self` is not the dummy span, and `other` otherwise.
|
/// Returns `self` if `self` is not the dummy span, and `other` otherwise.
|
||||||
pub fn substitute_dummy(self, other: Span) -> Span {
|
pub fn substitute_dummy(self, other: Span) -> Span {
|
||||||
if self.is_dummy() {
|
if self.is_dummy() { other } else { self }
|
||||||
other
|
|
||||||
} else {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if `self` fully encloses `other`.
|
/// Returns `true` if `self` fully encloses `other`.
|
||||||
|
@ -341,33 +337,21 @@ impl Span {
|
||||||
pub fn trim_start(self, other: Span) -> Option<Span> {
|
pub fn trim_start(self, other: Span) -> Option<Span> {
|
||||||
let span = self.data();
|
let span = self.data();
|
||||||
let other = other.data();
|
let other = other.data();
|
||||||
if span.hi > other.hi {
|
if span.hi > other.hi { Some(span.with_lo(cmp::max(span.lo, other.hi))) } else { None }
|
||||||
Some(span.with_lo(cmp::max(span.lo, other.hi)))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the source span -- this is either the supplied span, or the span for
|
/// Returns the source span -- this is either the supplied span, or the span for
|
||||||
/// the macro callsite that expanded to it.
|
/// the macro callsite that expanded to it.
|
||||||
pub fn source_callsite(self) -> Span {
|
pub fn source_callsite(self) -> Span {
|
||||||
let expn_data = self.ctxt().outer_expn_data();
|
let expn_data = self.ctxt().outer_expn_data();
|
||||||
if !expn_data.is_root() {
|
if !expn_data.is_root() { expn_data.call_site.source_callsite() } else { self }
|
||||||
expn_data.call_site.source_callsite()
|
|
||||||
} else {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
|
/// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
|
||||||
/// if any.
|
/// if any.
|
||||||
pub fn parent(self) -> Option<Span> {
|
pub fn parent(self) -> Option<Span> {
|
||||||
let expn_data = self.ctxt().outer_expn_data();
|
let expn_data = self.ctxt().outer_expn_data();
|
||||||
if !expn_data.is_root() {
|
if !expn_data.is_root() { Some(expn_data.call_site) } else { None }
|
||||||
Some(expn_data.call_site)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Edition of the crate from which this span came.
|
/// Edition of the crate from which this span came.
|
||||||
|
@ -393,18 +377,10 @@ impl Span {
|
||||||
pub fn source_callee(self) -> Option<ExpnData> {
|
pub fn source_callee(self) -> Option<ExpnData> {
|
||||||
fn source_callee(expn_data: ExpnData) -> ExpnData {
|
fn source_callee(expn_data: ExpnData) -> ExpnData {
|
||||||
let next_expn_data = expn_data.call_site.ctxt().outer_expn_data();
|
let next_expn_data = expn_data.call_site.ctxt().outer_expn_data();
|
||||||
if !next_expn_data.is_root() {
|
if !next_expn_data.is_root() { source_callee(next_expn_data) } else { expn_data }
|
||||||
source_callee(next_expn_data)
|
|
||||||
} else {
|
|
||||||
expn_data
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let expn_data = self.ctxt().outer_expn_data();
|
let expn_data = self.ctxt().outer_expn_data();
|
||||||
if !expn_data.is_root() {
|
if !expn_data.is_root() { Some(source_callee(expn_data)) } else { None }
|
||||||
Some(source_callee(expn_data))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if a span is "internal" to a macro in which `#[unstable]`
|
/// Checks if a span is "internal" to a macro in which `#[unstable]`
|
||||||
|
@ -1224,11 +1200,7 @@ impl SourceFile {
|
||||||
|
|
||||||
let line_index = lookup_line(&self.lines[..], pos);
|
let line_index = lookup_line(&self.lines[..], pos);
|
||||||
assert!(line_index < self.lines.len() as isize);
|
assert!(line_index < self.lines.len() as isize);
|
||||||
if line_index >= 0 {
|
if line_index >= 0 { Some(line_index as usize) } else { None }
|
||||||
Some(line_index as usize)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn line_bounds(&self, line_index: usize) -> (BytePos, BytePos) {
|
pub fn line_bounds(&self, line_index: usize) -> (BytePos, BytePos) {
|
||||||
|
|
|
@ -305,11 +305,7 @@ impl<'a, 'tcx> Expectation<'tcx> {
|
||||||
match *self {
|
match *self {
|
||||||
ExpectHasType(ety) => {
|
ExpectHasType(ety) => {
|
||||||
let ety = fcx.shallow_resolve(ety);
|
let ety = fcx.shallow_resolve(ety);
|
||||||
if !ety.is_ty_var() {
|
if !ety.is_ty_var() { ExpectHasType(ety) } else { NoExpectation }
|
||||||
ExpectHasType(ety)
|
|
||||||
} else {
|
|
||||||
NoExpectation
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ExpectRvalueLikeUnsized(ety) => ExpectRvalueLikeUnsized(ety),
|
ExpectRvalueLikeUnsized(ety) => ExpectRvalueLikeUnsized(ety),
|
||||||
_ => NoExpectation,
|
_ => NoExpectation,
|
||||||
|
@ -1622,11 +1618,7 @@ fn check_opaque_for_inheriting_lifetimes(tcx: TyCtxt<'tcx>, def_id: DefId, span:
|
||||||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueVisitor<'tcx> {
|
impl<'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueVisitor<'tcx> {
|
||||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
|
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
|
||||||
debug!("check_opaque_for_inheriting_lifetimes: (visit_ty) t={:?}", t);
|
debug!("check_opaque_for_inheriting_lifetimes: (visit_ty) t={:?}", t);
|
||||||
if t == self.opaque_identity_ty {
|
if t == self.opaque_identity_ty { false } else { t.super_visit_with(self) }
|
||||||
false
|
|
||||||
} else {
|
|
||||||
t.super_visit_with(self)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
|
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
|
||||||
|
@ -3775,8 +3767,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
&'b self,
|
&'b self,
|
||||||
self_ty: ty::TyVid,
|
self_ty: ty::TyVid,
|
||||||
) -> impl Iterator<Item = (ty::PolyTraitRef<'tcx>, traits::PredicateObligation<'tcx>)>
|
) -> impl Iterator<Item = (ty::PolyTraitRef<'tcx>, traits::PredicateObligation<'tcx>)>
|
||||||
+ Captures<'tcx>
|
+ Captures<'tcx>
|
||||||
+ 'b {
|
+ 'b {
|
||||||
// FIXME: consider using `sub_root_var` here so we
|
// FIXME: consider using `sub_root_var` here so we
|
||||||
// can see through subtyping.
|
// can see through subtyping.
|
||||||
let ty_var_root = self.root_var(self_ty);
|
let ty_var_root = self.root_var(self_ty);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue