about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2020-03-19 13:55:46 -0400
committerNiko Matsakis <niko@alum.mit.edu>2020-03-26 06:52:58 -0400
commit011215b2c7fcd9df884de1012a5c67d8e96adc69 (patch)
tree11592c7d9d5bb934456d5f069d6d213ac6c2305d
parentc35801e160ed521b62348cfe6557ef7b56130282 (diff)
downloadrust-011215b2c7fcd9df884de1012a5c67d8e96adc69.tar.gz
rust-011215b2c7fcd9df884de1012a5c67d8e96adc69.zip
pacify the merciless x.py fmt
-rw-r--r--src/librustc_span/lib.rs42
-rw-r--r--src/librustc_typeck/check/mod.rs16
2 files changed, 11 insertions, 47 deletions
diff --git a/src/librustc_span/lib.rs b/src/librustc_span/lib.rs
index 7a1aea15753..a0c4c90722d 100644
--- a/src/librustc_span/lib.rs
+++ b/src/librustc_span/lib.rs
@@ -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`.
@@ -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.
@@ -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]`
@@ -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) {
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index b282c7333d6..91ab94bc684 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -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,
@@ -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 {
@@ -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);