Skip to content

Commit 011215b

Browse files
committed
pacify the merciless x.py fmt
1 parent c35801e commit 011215b

File tree

2 files changed

+11
-47
lines changed

2 files changed

+11
-47
lines changed

src/librustc_span/lib.rs

+7-35
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,7 @@ impl Span {
306306

307307
/// Returns `self` if `self` is not the dummy span, and `other` otherwise.
308308
pub fn substitute_dummy(self, other: Span) -> Span {
309-
if self.is_dummy() {
310-
other
311-
} else {
312-
self
313-
}
309+
if self.is_dummy() { other } else { self }
314310
}
315311

316312
/// Returns `true` if `self` fully encloses `other`.
@@ -341,33 +337,21 @@ impl Span {
341337
pub fn trim_start(self, other: Span) -> Option<Span> {
342338
let span = self.data();
343339
let other = other.data();
344-
if span.hi > other.hi {
345-
Some(span.with_lo(cmp::max(span.lo, other.hi)))
346-
} else {
347-
None
348-
}
340+
if span.hi > other.hi { Some(span.with_lo(cmp::max(span.lo, other.hi))) } else { None }
349341
}
350342

351343
/// Returns the source span -- this is either the supplied span, or the span for
352344
/// the macro callsite that expanded to it.
353345
pub fn source_callsite(self) -> Span {
354346
let expn_data = self.ctxt().outer_expn_data();
355-
if !expn_data.is_root() {
356-
expn_data.call_site.source_callsite()
357-
} else {
358-
self
359-
}
347+
if !expn_data.is_root() { expn_data.call_site.source_callsite() } else { self }
360348
}
361349

362350
/// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
363351
/// if any.
364352
pub fn parent(self) -> Option<Span> {
365353
let expn_data = self.ctxt().outer_expn_data();
366-
if !expn_data.is_root() {
367-
Some(expn_data.call_site)
368-
} else {
369-
None
370-
}
354+
if !expn_data.is_root() { Some(expn_data.call_site) } else { None }
371355
}
372356

373357
/// Edition of the crate from which this span came.
@@ -393,18 +377,10 @@ impl Span {
393377
pub fn source_callee(self) -> Option<ExpnData> {
394378
fn source_callee(expn_data: ExpnData) -> ExpnData {
395379
let next_expn_data = expn_data.call_site.ctxt().outer_expn_data();
396-
if !next_expn_data.is_root() {
397-
source_callee(next_expn_data)
398-
} else {
399-
expn_data
400-
}
380+
if !next_expn_data.is_root() { source_callee(next_expn_data) } else { expn_data }
401381
}
402382
let expn_data = self.ctxt().outer_expn_data();
403-
if !expn_data.is_root() {
404-
Some(source_callee(expn_data))
405-
} else {
406-
None
407-
}
383+
if !expn_data.is_root() { Some(source_callee(expn_data)) } else { None }
408384
}
409385

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

12251201
let line_index = lookup_line(&self.lines[..], pos);
12261202
assert!(line_index < self.lines.len() as isize);
1227-
if line_index >= 0 {
1228-
Some(line_index as usize)
1229-
} else {
1230-
None
1231-
}
1203+
if line_index >= 0 { Some(line_index as usize) } else { None }
12321204
}
12331205

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

src/librustc_typeck/check/mod.rs

+4-12
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,
@@ -1622,11 +1618,7 @@ fn check_opaque_for_inheriting_lifetimes(tcx: TyCtxt<'tcx>, def_id: DefId, span:
16221618
impl<'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueVisitor<'tcx> {
16231619
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
16241620
debug!("check_opaque_for_inheriting_lifetimes: (visit_ty) t={:?}", t);
1625-
if t == self.opaque_identity_ty {
1626-
false
1627-
} else {
1628-
t.super_visit_with(self)
1629-
}
1621+
if t == self.opaque_identity_ty { false } else { t.super_visit_with(self) }
16301622
}
16311623

16321624
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
@@ -3775,8 +3767,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
37753767
&'b self,
37763768
self_ty: ty::TyVid,
37773769
) -> impl Iterator<Item = (ty::PolyTraitRef<'tcx>, traits::PredicateObligation<'tcx>)>
3778-
+ Captures<'tcx>
3779-
+ 'b {
3770+
+ Captures<'tcx>
3771+
+ 'b {
37803772
// FIXME: consider using `sub_root_var` here so we
37813773
// can see through subtyping.
37823774
let ty_var_root = self.root_var(self_ty);

0 commit comments

Comments
 (0)