From 1232d99dd39dcee7087e5e7570f758fcfc63fb89 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 4 Oct 2023 09:14:39 -0700 Subject: [PATCH] rustdoc: clean up search index generator code Co-Authored-By: Guillaume Gomez --- src/librustdoc/html/render/search_index.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 5b48e5e1465d3..195ba8340fd8a 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -185,11 +185,10 @@ pub(crate) fn build_index<'tcx>( lastpathid, crate_paths, ); - if let Some(converted_associated_type) = converted_associated_type { - *associated_type = converted_associated_type; - } else { + let Some(converted_associated_type) = converted_associated_type else { return false; - } + }; + *associated_type = converted_associated_type; for constraint in constraints { convert_render_type( constraint, @@ -508,15 +507,9 @@ pub(crate) fn get_function_type_for_search<'tcx>( } }); let (mut inputs, mut output, where_clause) = match *item.kind { - clean::FunctionItem(ref f) => { + clean::FunctionItem(ref f) | clean::MethodItem(ref f, _) | clean::TyMethodItem(ref f) => { get_fn_inputs_and_outputs(f, tcx, impl_or_trait_generics, cache) } - clean::MethodItem(ref m, _) => { - get_fn_inputs_and_outputs(m, tcx, impl_or_trait_generics, cache) - } - clean::TyMethodItem(ref m) => { - get_fn_inputs_and_outputs(m, tcx, impl_or_trait_generics, cache) - } _ => return None, };