]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/bool.rs
Rollup merge of #68326 - ollie27:rustdoc_hightlight_fatal_errors, r=GuillaumeGomez
[rust.git] / src / libcore / bool.rs
index 1b3c254a05f98126a3ff6b0a47ed1b407dba3671..6e0865e8653b7cfb769f62dbdb2dd6042ef20130 100644 (file)
@@ -15,11 +15,7 @@ impl bool {
     #[unstable(feature = "bool_to_option", issue = "64260")]
     #[inline]
     pub fn then_some<T>(self, t: T) -> Option<T> {
-        if self {
-            Some(t)
-        } else {
-            None
-        }
+        if self { Some(t) } else { None }
     }
 
     /// Returns `Some(f())` if the `bool` is `true`, or `None` otherwise.
@@ -35,10 +31,6 @@ pub fn then_some<T>(self, t: T) -> Option<T> {
     #[unstable(feature = "bool_to_option", issue = "64260")]
     #[inline]
     pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
-        if self {
-            Some(f())
-        } else {
-            None
-        }
+        if self { Some(f()) } else { None }
     }
 }