diff options
| author | est31 <MTest31@outlook.com> | 2022-02-19 00:43:47 +0100 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2022-03-04 10:33:29 +0100 |
| commit | 565f644edfb83c2e5bc082fea2bf7045639fb179 (patch) | |
| tree | 0204f6f143aa827475c7e83b7423ad7acd014391 /src/librustdoc/html/render | |
| parent | 65f6d33b775eddfc0128c04083bbf3beea360114 (diff) | |
| download | rust-565f644edfb83c2e5bc082fea2bf7045639fb179.tar.gz rust-565f644edfb83c2e5bc082fea2bf7045639fb179.zip | |
librustdoc: adopt let else in more places
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/context.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 12 |
2 files changed, 4 insertions, 14 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 3f71a53f963..34784bbed0c 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -655,10 +655,8 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { // Render sidebar-items.js used throughout this module. if !self.render_redirect_pages { - let module = match *item.kind { - clean::StrippedItem(box clean::ModuleItem(ref m)) | clean::ModuleItem(ref m) => m, - _ => 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!("initSidebarItems({});", serde_json::to_string(&items).unwrap()); diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 558dbb3b396..d3c9fdc48dd 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1058,10 +1058,7 @@ fn render_assoc_items_inner( ) { info!("Documenting associated items of {:?}", containing_item.name); let cache = cx.cache(); - let v = match cache.impls.get(&it) { - Some(v) => v, - None => return, - }; + let Some(v) = cache.impls.get(&it) else { return }; let (non_trait, traits): (Vec<_>, _) = v.iter().partition(|i| i.inner_impl().trait_.is_none()); if !non_trait.is_empty() { let mut tmp_buf = Buffer::empty_from(w); @@ -2654,12 +2651,7 @@ fn render_call_locations(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item) { let tcx = cx.tcx(); let def_id = item.def_id.expect_def_id(); let key = tcx.def_path_hash(def_id); - let call_locations = match cx.shared.call_locations.get(&key) { - Some(call_locations) => call_locations, - _ => { - return; - } - }; + let Some(call_locations) = cx.shared.call_locations.get(&key) else { return }; // Generate a unique ID so users can link to this section for a given method let id = cx.id_map.borrow_mut().derive("scraped-examples"); |
