Skip to content

Commit

Permalink
pacify the merciless x.py fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Mar 26, 2020
1 parent c35801e commit 011215b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 47 deletions.
42 changes: 7 additions & 35 deletions src/librustc_span/lib.rs
Expand Up @@ -306,11 +306,7 @@ impl Span {

/// Returns `self` if `self` is not the dummy span, and `other` otherwise.
pub fn substitute_dummy(self, other: Span) -> Span {
if self.is_dummy() {
other
} else {
self
}
if self.is_dummy() { other } else { self }
}

/// Returns `true` if `self` fully encloses `other`.
Expand Down Expand Up @@ -341,33 +337,21 @@ impl Span {
pub fn trim_start(self, other: Span) -> Option<Span> {
let span = self.data();
let other = other.data();
if span.hi > other.hi {
Some(span.with_lo(cmp::max(span.lo, other.hi)))
} else {
None
}
if span.hi > other.hi { 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
/// the macro callsite that expanded to it.
pub fn source_callsite(self) -> Span {
let expn_data = self.ctxt().outer_expn_data();
if !expn_data.is_root() {
expn_data.call_site.source_callsite()
} else {
self
}
if !expn_data.is_root() { expn_data.call_site.source_callsite() } else { self }
}

/// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
/// if any.
pub fn parent(self) -> Option<Span> {
let expn_data = self.ctxt().outer_expn_data();
if !expn_data.is_root() {
Some(expn_data.call_site)
} else {
None
}
if !expn_data.is_root() { Some(expn_data.call_site) } else { None }
}

/// Edition of the crate from which this span came.
Expand All @@ -393,18 +377,10 @@ impl Span {
pub fn source_callee(self) -> Option<ExpnData> {
fn source_callee(expn_data: ExpnData) -> ExpnData {
let next_expn_data = expn_data.call_site.ctxt().outer_expn_data();
if !next_expn_data.is_root() {
source_callee(next_expn_data)
} else {
expn_data
}
if !next_expn_data.is_root() { source_callee(next_expn_data) } else { expn_data }
}
let expn_data = self.ctxt().outer_expn_data();
if !expn_data.is_root() {
Some(source_callee(expn_data))
} else {
None
}
if !expn_data.is_root() { Some(source_callee(expn_data)) } else { None }
}

/// Checks if a span is "internal" to a macro in which `#[unstable]`
Expand Down Expand Up @@ -1224,11 +1200,7 @@ impl SourceFile {

let line_index = lookup_line(&self.lines[..], pos);
assert!(line_index < self.lines.len() as isize);
if line_index >= 0 {
Some(line_index as usize)
} else {
None
}
if line_index >= 0 { Some(line_index as usize) } else { None }
}

pub fn line_bounds(&self, line_index: usize) -> (BytePos, BytePos) {
Expand Down
16 changes: 4 additions & 12 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -305,11 +305,7 @@ impl<'a, 'tcx> Expectation<'tcx> {
match *self {
ExpectHasType(ety) => {
let ety = fcx.shallow_resolve(ety);
if !ety.is_ty_var() {
ExpectHasType(ety)
} else {
NoExpectation
}
if !ety.is_ty_var() { ExpectHasType(ety) } else { NoExpectation }
}
ExpectRvalueLikeUnsized(ety) => ExpectRvalueLikeUnsized(ety),
_ => NoExpectation,
Expand Down Expand Up @@ -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> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
debug!("check_opaque_for_inheriting_lifetimes: (visit_ty) t={:?}", t);
if t == self.opaque_identity_ty {
false
} else {
t.super_visit_with(self)
}
if t == self.opaque_identity_ty { false } else { t.super_visit_with(self) }
}

fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
Expand Down Expand Up @@ -3775,8 +3767,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
&'b self,
self_ty: ty::TyVid,
) -> impl Iterator<Item = (ty::PolyTraitRef<'tcx>, traits::PredicateObligation<'tcx>)>
+ Captures<'tcx>
+ 'b {
+ Captures<'tcx>
+ 'b {
// FIXME: consider using `sub_root_var` here so we
// can see through subtyping.
let ty_var_root = self.root_var(self_ty);
Expand Down

0 comments on commit 011215b

Please sign in to comment.