Skip to content

Commit 62d46f8

Browse files
committed
pacify the merciless x.py fmt
1 parent e6db481 commit 62d46f8

File tree

2 files changed

+11
-47
lines changed

2 files changed

+11
-47
lines changed

src/librustc_span/lib.rs

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,7 @@ impl Span {
316316

317317
/// Returns `self` if `self` is not the dummy span, and `other` otherwise.
318318
pub fn substitute_dummy(self, other: Span) -> Span {
319-
if self.is_dummy() {
320-
other
321-
} else {
322-
self
323-
}
319+
if self.is_dummy() { other } else { self }
324320
}
325321

326322
/// Returns `true` if `self` fully encloses `other`.
@@ -351,33 +347,21 @@ impl Span {
351347
pub fn trim_start(self, other: Span) -> Option<Span> {
352348
let span = self.data();
353349
let other = other.data();
354-
if span.hi > other.hi {
355-
Some(span.with_lo(cmp::max(span.lo, other.hi)))
356-
} else {
357-
None
358-
}
350+
if span.hi > other.hi { Some(span.with_lo(cmp::max(span.lo, other.hi))) } else { None }
359351
}
360352

361353
/// Returns the source span -- this is either the supplied span, or the span for
362354
/// the macro callsite that expanded to it.
363355
pub fn source_callsite(self) -> Span {
364356
let expn_data = self.ctxt().outer_expn_data();
365-
if !expn_data.is_root() {
366-
expn_data.call_site.source_callsite()
367-
} else {
368-
self
369-
}
357+
if !expn_data.is_root() { expn_data.call_site.source_callsite() } else { self }
370358
}
371359

372360
/// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
373361
/// if any.
374362
pub fn parent(self) -> Option<Span> {
375363
let expn_data = self.ctxt().outer_expn_data();
376-
if !expn_data.is_root() {
377-
Some(expn_data.call_site)
378-
} else {
379-
None
380-
}
364+
if !expn_data.is_root() { Some(expn_data.call_site) } else { None }
381365
}
382366

383367
/// Edition of the crate from which this span came.
@@ -403,18 +387,10 @@ impl Span {
403387
pub fn source_callee(self) -> Option<ExpnData> {
404388
fn source_callee(expn_data: ExpnData) -> ExpnData {
405389
let next_expn_data = expn_data.call_site.ctxt().outer_expn_data();
406-
if !next_expn_data.is_root() {
407-
source_callee(next_expn_data)
408-
} else {
409-
expn_data
410-
}
390+
if !next_expn_data.is_root() { source_callee(next_expn_data) } else { expn_data }
411391
}
412392
let expn_data = self.ctxt().outer_expn_data();
413-
if !expn_data.is_root() {
414-
Some(source_callee(expn_data))
415-
} else {
416-
None
417-
}
393+
if !expn_data.is_root() { Some(source_callee(expn_data)) } else { None }
418394
}
419395

420396
/// Checks if a span is "internal" to a macro in which `#[unstable]`
@@ -1234,11 +1210,7 @@ impl SourceFile {
12341210

12351211
let line_index = lookup_line(&self.lines[..], pos);
12361212
assert!(line_index < self.lines.len() as isize);
1237-
if line_index >= 0 {
1238-
Some(line_index as usize)
1239-
} else {
1240-
None
1241-
}
1213+
if line_index >= 0 { Some(line_index as usize) } else { None }
12421214
}
12431215

12441216
pub fn line_bounds(&self, line_index: usize) -> (BytePos, BytePos) {

src/librustc_typeck/check/mod.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,7 @@ impl<'a, 'tcx> Expectation<'tcx> {
305305
match *self {
306306
ExpectHasType(ety) => {
307307
let ety = fcx.shallow_resolve(ety);
308-
if !ety.is_ty_var() {
309-
ExpectHasType(ety)
310-
} else {
311-
NoExpectation
312-
}
308+
if !ety.is_ty_var() { ExpectHasType(ety) } else { NoExpectation }
313309
}
314310
ExpectRvalueLikeUnsized(ety) => ExpectRvalueLikeUnsized(ety),
315311
_ => NoExpectation,
@@ -1619,11 +1615,7 @@ fn check_opaque_for_inheriting_lifetimes(tcx: TyCtxt<'tcx>, def_id: DefId, span:
16191615
impl<'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueVisitor<'tcx> {
16201616
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
16211617
debug!("check_opaque_for_inheriting_lifetimes: (visit_ty) t={:?}", t);
1622-
if t == self.opaque_identity_ty {
1623-
false
1624-
} else {
1625-
t.super_visit_with(self)
1626-
}
1618+
if t == self.opaque_identity_ty { false } else { t.super_visit_with(self) }
16271619
}
16281620

16291621
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
@@ -3778,8 +3770,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
37783770
&'b self,
37793771
self_ty: ty::TyVid,
37803772
) -> impl Iterator<Item = (ty::PolyTraitRef<'tcx>, traits::PredicateObligation<'tcx>)>
3781-
+ Captures<'tcx>
3782-
+ 'b {
3773+
+ Captures<'tcx>
3774+
+ 'b {
37833775
// FIXME: consider using `sub_root_var` here so we
37843776
// can see through subtyping.
37853777
let ty_var_root = self.root_var(self_ty);

0 commit comments

Comments
 (0)