don't create variable bindings just to return the bound value immediately (clippy::let_and_return)

This commit is contained in:
Matthias Krüger 2020-03-22 00:20:58 +01:00
parent 3599fd389d
commit 74d68ea7eb
15 changed files with 33 additions and 60 deletions

View file

@ -507,7 +507,7 @@ pub fn print_const(cx: &DocContext<'_>, n: &'tcx ty::Const<'_>) -> String {
}
pub fn print_evaluated_const(cx: &DocContext<'_>, def_id: DefId) -> Option<String> {
let value = cx.tcx.const_eval_poly(def_id).ok().and_then(|val| {
cx.tcx.const_eval_poly(def_id).ok().and_then(|val| {
let ty = cx.tcx.type_of(def_id);
match (val, &ty.kind) {
(_, &ty::Ref(..)) => None,
@ -518,9 +518,7 @@ pub fn print_evaluated_const(cx: &DocContext<'_>, def_id: DefId) -> Option<Strin
}
_ => None,
}
});
value
})
}
fn format_integer_with_underscore_sep(num: &str) -> String {

View file

@ -666,13 +666,12 @@ fn get_index_search_type(item: &clean::Item) -> Option<IndexItemFunctionType> {
}
fn get_index_type(clean_type: &clean::Type) -> RenderType {
let t = RenderType {
RenderType {
ty: clean_type.def_id(),
idx: None,
name: get_index_type_name(clean_type, true).map(|s| s.to_ascii_lowercase()),
generics: get_generics(clean_type),
};
t
}
}
fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option<String> {