about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/clean.rs4
-rw-r--r--src/bootstrap/format.rs8
-rw-r--r--src/librustdoc/clean/blanket_impl.rs10
-rw-r--r--src/librustdoc/clean/mod.rs3
-rw-r--r--src/librustdoc/clean/simplify.rs4
-rw-r--r--src/librustdoc/clean/types.rs14
-rw-r--r--src/librustdoc/clean/utils.rs3
-rw-r--r--src/librustdoc/doctest.rs3
-rw-r--r--src/librustdoc/formats/renderer.rs7
-rw-r--r--src/librustdoc/html/format.rs7
-rw-r--r--src/librustdoc/html/highlight.rs6
-rw-r--r--src/librustdoc/html/render/context.rs7
-rw-r--r--src/librustdoc/html/render/mod.rs4
-rw-r--r--src/librustdoc/passes/check_doc_test_visibility.rs3
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs3
-rw-r--r--src/librustdoc/passes/lint/bare_urls.rs9
-rw-r--r--src/librustdoc/passes/lint/check_code_block_syntax.rs11
-rw-r--r--src/librustdoc/passes/lint/html_tags.rs4
-rw-r--r--src/librustdoc/passes/propagate_doc_cfg.rs5
-rw-r--r--src/tools/build_helper/src/git.rs8
-rw-r--r--src/tools/collect-license-metadata/src/path_tree.rs5
-rw-r--r--src/tools/compiletest/src/header.rs5
22 files changed, 76 insertions, 57 deletions
diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs
index c1d867a0bd1..ea8334eaeb6 100644
--- a/src/bootstrap/clean.rs
+++ b/src/bootstrap/clean.rs
@@ -26,7 +26,9 @@ impl Step for CleanAll {
     }
 
     fn run(self, builder: &Builder<'_>) -> Self::Output {
-        let Subcommand::Clean { all, .. } = builder.config.cmd else { unreachable!("wrong subcommand?") };
+        let Subcommand::Clean { all, .. } = builder.config.cmd else {
+            unreachable!("wrong subcommand?")
+        };
         clean_default(builder.build, all)
     }
 
diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs
index ebf068b2cb1..4330e126398 100644
--- a/src/bootstrap/format.rs
+++ b/src/bootstrap/format.rs
@@ -66,13 +66,17 @@ fn get_rustfmt_version(build: &Builder<'_>) -> Option<(String, PathBuf)> {
 
 /// Return whether the format cache can be reused.
 fn verify_rustfmt_version(build: &Builder<'_>) -> bool {
-    let Some((version, stamp_file)) = get_rustfmt_version(build) else {return false;};
+    let Some((version, stamp_file)) = get_rustfmt_version(build) else {
+        return false;
+    };
     !program_out_of_date(&stamp_file, &version)
 }
 
 /// Updates the last rustfmt version used
 fn update_rustfmt_version(build: &Builder<'_>) {
-    let Some((version, stamp_file)) = get_rustfmt_version(build) else {return;};
+    let Some((version, stamp_file)) = get_rustfmt_version(build) else {
+        return;
+    };
     t!(std::fs::write(stamp_file, version))
 }
 
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs
index a3604158851..c4ac5466164 100644
--- a/src/librustdoc/clean/blanket_impl.rs
+++ b/src/librustdoc/clean/blanket_impl.rs
@@ -47,9 +47,13 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
 
                 // Require the type the impl is implemented on to match
                 // our type, and ignore the impl if there was a mismatch.
-                let Ok(eq_result) = infcx.at(&traits::ObligationCause::dummy(), param_env).eq(DefineOpaqueTypes::No, impl_trait_ref.self_ty(), impl_ty) else {
-                        continue
-                    };
+                let Ok(eq_result) = infcx.at(&traits::ObligationCause::dummy(), param_env).eq(
+                    DefineOpaqueTypes::No,
+                    impl_trait_ref.self_ty(),
+                    impl_ty,
+                ) else {
+                    continue;
+                };
                 let InferOk { value: (), obligations } = eq_result;
                 // FIXME(eddyb) ignoring `obligations` might cause false positives.
                 drop(obligations);
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 0182d50773d..d26de77a78d 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -167,8 +167,7 @@ fn clean_generic_bound<'tcx>(
             let trait_ref = ty::Binder::dummy(ty::TraitRef::identity(cx.tcx, def_id));
 
             let generic_args = clean_generic_args(generic_args, cx);
-            let GenericArgs::AngleBracketed { bindings, .. } = generic_args
-            else {
+            let GenericArgs::AngleBracketed { bindings, .. } = generic_args else {
                 bug!("clean: parenthesized `GenericBound::LangItemTrait`");
             };
 
diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs
index 65b1b72adc1..d53b038019b 100644
--- a/src/librustdoc/clean/simplify.rs
+++ b/src/librustdoc/clean/simplify.rs
@@ -47,7 +47,9 @@ pub(crate) fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> ThinVec<WP
     // Look for equality predicates on associated types that can be merged into
     // general bound predicates.
     equalities.retain(|(lhs, rhs, bound_params)| {
-        let Some((ty, trait_did, name)) = lhs.projection() else { return true; };
+        let Some((ty, trait_did, name)) = lhs.projection() else {
+            return true;
+        };
         let Some((bounds, _)) = tybounds.get_mut(ty) else { return true };
         merge_bounds(cx, bounds, bound_params.clone(), trait_did, name, rhs)
     });
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs
index 26139d52769..eccc881d6b1 100644
--- a/src/librustdoc/clean/types.rs
+++ b/src/librustdoc/clean/types.rs
@@ -451,11 +451,7 @@ impl Item {
     pub(crate) fn links(&self, cx: &Context<'_>) -> Vec<RenderedLink> {
         use crate::html::format::{href, link_tooltip};
 
-        let Some(links) = cx.cache()
-            .intra_doc_links
-            .get(&self.item_id) else {
-                return vec![]
-            };
+        let Some(links) = cx.cache().intra_doc_links.get(&self.item_id) else { return vec![] };
         links
             .iter()
             .filter_map(|ItemLink { link: s, link_text, page_id: id, ref fragment }| {
@@ -484,11 +480,9 @@ impl Item {
     /// the link text, but does need to know which `[]`-bracketed names
     /// are actually links.
     pub(crate) fn link_names(&self, cache: &Cache) -> Vec<RenderedLink> {
-        let Some(links) = cache
-            .intra_doc_links
-            .get(&self.item_id) else {
-                return vec![];
-            };
+        let Some(links) = cache.intra_doc_links.get(&self.item_id) else {
+            return vec![];
+        };
         links
             .iter()
             .map(|ItemLink { link: s, link_text, .. }| RenderedLink {
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs
index f375f0efbd1..d6a970fba39 100644
--- a/src/librustdoc/clean/utils.rs
+++ b/src/librustdoc/clean/utils.rs
@@ -54,8 +54,7 @@ pub(crate) fn krate(cx: &mut DocContext<'_>) -> Crate {
     let primitives = local_crate.primitives(cx.tcx);
     let keywords = local_crate.keywords(cx.tcx);
     {
-        let ItemKind::ModuleItem(ref mut m) = *module.kind
-        else { unreachable!() };
+        let ItemKind::ModuleItem(ref mut m) = *module.kind else { unreachable!() };
         m.items.extend(primitives.iter().map(|&(def_id, prim)| {
             Item::from_def_id_and_parts(
                 def_id,
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 217257316c8..6047cf23350 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -653,8 +653,7 @@ pub(crate) fn make_test(
             (found_main, found_extern_crate, found_macro)
         })
     });
-    let Ok((already_has_main, already_has_extern_crate, found_macro)) = result
-    else {
+    let Ok((already_has_main, already_has_extern_crate, found_macro)) = result else {
         // If the parser panicked due to a fatal error, pass the test code through unchanged.
         // The error will be reported during compilation.
         return (s.to_owned(), 0, false);
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs
index 6f9cc026675..c49f1a4d37e 100644
--- a/src/librustdoc/formats/renderer.rs
+++ b/src/librustdoc/formats/renderer.rs
@@ -77,8 +77,11 @@ pub(crate) fn run_format<'tcx, T: FormatRenderer<'tcx>>(
                 prof.generic_activity_with_arg("render_mod_item", item.name.unwrap().to_string());
 
             cx.mod_item_in(&item)?;
-            let (clean::StrippedItem(box clean::ModuleItem(module)) | clean::ModuleItem(module)) = *item.kind
-            else { unreachable!() };
+            let (clean::StrippedItem(box clean::ModuleItem(module)) | clean::ModuleItem(module)) =
+                *item.kind
+            else {
+                unreachable!()
+            };
             for it in module.items {
                 debug!("Adding {:?} to worklist", it.name);
                 work.push((cx.make_child_renderer(), it));
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 54c0cd2ef7f..1099c68b004 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -771,9 +771,10 @@ pub(crate) fn href_relative_parts<'fqp>(
 
 pub(crate) fn link_tooltip(did: DefId, fragment: &Option<UrlFragment>, cx: &Context<'_>) -> String {
     let cache = cx.cache();
-    let Some((fqp, shortty)) = cache.paths.get(&did)
-        .or_else(|| cache.external_paths.get(&did))
-        else { return String::new() };
+    let Some((fqp, shortty)) = cache.paths.get(&did).or_else(|| cache.external_paths.get(&did))
+    else {
+        return String::new();
+    };
     let mut buf = Buffer::new();
     let fqp = if *shortty == ItemType::Primitive {
         // primitives are documented in a crate, but not actually part of it
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index c94968b4817..0aee79a6947 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -928,13 +928,11 @@ fn string_without_closing_tag<T: Display>(
     href_context: &Option<HrefContext<'_, '_>>,
     open_tag: bool,
 ) -> Option<&'static str> {
-    let Some(klass) = klass
-    else {
+    let Some(klass) = klass else {
         write!(out, "{}", text).unwrap();
         return None;
     };
-    let Some(def_span) = klass.get_span()
-    else {
+    let Some(def_span) = klass.get_span() else {
         if !open_tag {
             write!(out, "{}", text).unwrap();
             return None;
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 4c476263635..aa72af001df 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -805,8 +805,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
 
         // Render sidebar-items.js used throughout this module.
         if !self.render_redirect_pages {
-            let (clean::StrippedItem(box clean::ModuleItem(ref module)) | clean::ModuleItem(ref module)) = *item.kind
-            else { unreachable!() };
+            let (clean::StrippedItem(box clean::ModuleItem(ref module))
+            | clean::ModuleItem(ref module)) = *item.kind
+            else {
+                unreachable!()
+            };
             let items = self.build_sidebar_items(module);
             let js_dst = self.dst.join(&format!("sidebar-items{}.js", self.shared.resource_suffix));
             let v = format!("window.SIDEBAR_ITEMS = {};", serde_json::to_string(&items).unwrap());
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index f923f905451..8a1ce9fb135 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1988,7 +1988,9 @@ pub(crate) fn get_filtered_impls_for_reference<'a>(
 ) -> (Vec<&'a Impl>, Vec<&'a Impl>, Vec<&'a Impl>) {
     let def_id = it.item_id.expect_def_id();
     // If the reference primitive is somehow not defined, exit early.
-    let Some(v) = shared.cache.impls.get(&def_id) else { return (Vec::new(), Vec::new(), Vec::new()) };
+    let Some(v) = shared.cache.impls.get(&def_id) else {
+        return (Vec::new(), Vec::new(), Vec::new());
+    };
     // Since there is no "direct implementation" on the reference primitive type, we filter out
     // every implementation which isn't a trait implementation.
     let traits = v.iter().filter(|i| i.inner_impl().trait_.is_some());
diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs
index b6cd897d317..1aa12e3ced2 100644
--- a/src/librustdoc/passes/check_doc_test_visibility.rs
+++ b/src/librustdoc/passes/check_doc_test_visibility.rs
@@ -106,8 +106,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
 }
 
 pub(crate) fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {
-    let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id)
-    else {
+    let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id) else {
         // If non-local, no need to check anything.
         return;
     };
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index ca511d956b9..6df2b973551 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -1610,8 +1610,7 @@ fn report_diagnostic(
     DiagnosticInfo { item, ori_link: _, dox, link_range }: &DiagnosticInfo<'_>,
     decorate: impl FnOnce(&mut Diagnostic, Option<rustc_span::Span>, MarkdownLinkRange),
 ) {
-    let Some(hir_id) = DocContext::as_local_hir_id(tcx, item.item_id)
-    else {
+    let Some(hir_id) = DocContext::as_local_hir_id(tcx, item.item_id) else {
         // If non-local, no need to check anything.
         info!("ignoring warning from parent crate: {}", msg);
         return;
diff --git a/src/librustdoc/passes/lint/bare_urls.rs b/src/librustdoc/passes/lint/bare_urls.rs
index e9cee92d22b..5658b31d9bb 100644
--- a/src/librustdoc/passes/lint/bare_urls.rs
+++ b/src/librustdoc/passes/lint/bare_urls.rs
@@ -13,11 +13,10 @@ use std::mem;
 use std::sync::LazyLock;
 
 pub(super) fn visit_item(cx: &DocContext<'_>, item: &Item) {
-    let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id)
-        else {
-            // If non-local, no need to check anything.
-            return;
-        };
+    let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id) else {
+        // If non-local, no need to check anything.
+        return;
+    };
     let dox = item.doc_value();
     if !dox.is_empty() {
         let report_diag =
diff --git a/src/librustdoc/passes/lint/check_code_block_syntax.rs b/src/librustdoc/passes/lint/check_code_block_syntax.rs
index f489f5081da..369a8069593 100644
--- a/src/librustdoc/passes/lint/check_code_block_syntax.rs
+++ b/src/librustdoc/passes/lint/check_code_block_syntax.rs
@@ -67,12 +67,11 @@ fn check_rust_syntax(
         return;
     }
 
-    let Some(local_id) = item.item_id.as_def_id().and_then(|x| x.as_local())
-        else {
-            // We don't need to check the syntax for other crates so returning
-            // without doing anything should not be a problem.
-            return;
-        };
+    let Some(local_id) = item.item_id.as_def_id().and_then(|x| x.as_local()) else {
+        // We don't need to check the syntax for other crates so returning
+        // without doing anything should not be a problem.
+        return;
+    };
 
     let empty_block = code_block.lang_string == Default::default() && code_block.is_fenced;
     let is_ignore = code_block.lang_string.ignore != markdown::Ignore::None;
diff --git a/src/librustdoc/passes/lint/html_tags.rs b/src/librustdoc/passes/lint/html_tags.rs
index 5273f52bc6f..24f452b216c 100644
--- a/src/librustdoc/passes/lint/html_tags.rs
+++ b/src/librustdoc/passes/lint/html_tags.rs
@@ -14,7 +14,9 @@ pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) {
     let tcx = cx.tcx;
     let Some(hir_id) = DocContext::as_local_hir_id(tcx, item.item_id)
     // If non-local, no need to check anything.
-    else { return };
+    else {
+        return;
+    };
     let dox = item.doc_value();
     if !dox.is_empty() {
         let report_diag = |msg: String, range: &Range<usize>, is_open_tag: bool| {
diff --git a/src/librustdoc/passes/propagate_doc_cfg.rs b/src/librustdoc/passes/propagate_doc_cfg.rs
index 8a33e51b3be..95273a225a9 100644
--- a/src/librustdoc/passes/propagate_doc_cfg.rs
+++ b/src/librustdoc/passes/propagate_doc_cfg.rs
@@ -38,8 +38,9 @@ impl<'a, 'tcx> CfgPropagator<'a, 'tcx> {
             _ => return,
         };
 
-        let Some(def_id) = item.item_id.as_def_id().and_then(|def_id| def_id.as_local())
-            else { return };
+        let Some(def_id) = item.item_id.as_def_id().and_then(|def_id| def_id.as_local()) else {
+            return;
+        };
 
         if check_parent {
             let expected_parent = self.cx.tcx.opt_local_parent(def_id);
diff --git a/src/tools/build_helper/src/git.rs b/src/tools/build_helper/src/git.rs
index 168633c8f63..66876e02c19 100644
--- a/src/tools/build_helper/src/git.rs
+++ b/src/tools/build_helper/src/git.rs
@@ -94,7 +94,9 @@ pub fn get_git_modified_files(
     git_dir: Option<&Path>,
     extensions: &Vec<&str>,
 ) -> Result<Option<Vec<String>>, String> {
-    let Ok(updated_master) = updated_master_branch(git_dir) else { return Ok(None); };
+    let Ok(updated_master) = updated_master_branch(git_dir) else {
+        return Ok(None);
+    };
 
     let git = || {
         let mut git = Command::new("git");
@@ -119,7 +121,9 @@ pub fn get_git_modified_files(
 
 /// Returns the files that haven't been added to git yet.
 pub fn get_git_untracked_files(git_dir: Option<&Path>) -> Result<Option<Vec<String>>, String> {
-    let Ok(_updated_master) = updated_master_branch(git_dir) else { return Ok(None); };
+    let Ok(_updated_master) = updated_master_branch(git_dir) else {
+        return Ok(None);
+    };
     let mut git = Command::new("git");
     if let Some(git_dir) = git_dir {
         git.current_dir(git_dir);
diff --git a/src/tools/collect-license-metadata/src/path_tree.rs b/src/tools/collect-license-metadata/src/path_tree.rs
index 68b6cef6432..709d91897e6 100644
--- a/src/tools/collect-license-metadata/src/path_tree.rs
+++ b/src/tools/collect-license-metadata/src/path_tree.rs
@@ -155,7 +155,10 @@ impl Node<LicenseId> {
                         name: child_name,
                         children: child_children,
                         license: child_license,
-                    } = child else { continue };
+                    } = child
+                    else {
+                        continue;
+                    };
 
                     if child_license != license {
                         continue;
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index ad10c3e07ce..1779b26c422 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -599,7 +599,10 @@ pub fn line_directive<'line>(
         if ln.starts_with('[') {
             // A comment like `//[foo]` is specific to revision `foo`
             let Some(close_brace) = ln.find(']') else {
-                panic!("malformed condition directive: expected `{}[foo]`, found `{}`", comment, ln);
+                panic!(
+                    "malformed condition directive: expected `{}[foo]`, found `{}`",
+                    comment, ln
+                );
             };
 
             let lncfg = &ln[1..close_brace];