mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Auto merge of #106907 - matthiaskrgr:rustdoc_ref, r=GuillaumeGomez
rustdoc: simplify some & ref erences
This commit is contained in:
commit
41edaac716
@ -402,15 +402,13 @@ where
|
||||
bound_params: Vec::new(),
|
||||
})
|
||||
})
|
||||
.chain(
|
||||
lifetime_to_bounds.into_iter().filter(|&(_, ref bounds)| !bounds.is_empty()).map(
|
||||
|(lifetime, bounds)| {
|
||||
let mut bounds_vec = bounds.into_iter().collect();
|
||||
self.sort_where_bounds(&mut bounds_vec);
|
||||
WherePredicate::RegionPredicate { lifetime, bounds: bounds_vec }
|
||||
},
|
||||
),
|
||||
)
|
||||
.chain(lifetime_to_bounds.into_iter().filter(|(_, bounds)| !bounds.is_empty()).map(
|
||||
|(lifetime, bounds)| {
|
||||
let mut bounds_vec = bounds.into_iter().collect();
|
||||
self.sort_where_bounds(&mut bounds_vec);
|
||||
WherePredicate::RegionPredicate { lifetime, bounds: bounds_vec }
|
||||
},
|
||||
))
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ 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(|&(ref lhs, ref rhs, ref bound_params)| {
|
||||
equalities.retain(|(lhs, rhs, bound_params)| {
|
||||
let Some((ty, trait_did, name)) = lhs.projection() else { return true; };
|
||||
let Some((bounds, _)) = tybounds.get_mut(ty) else { return true };
|
||||
let bound_params = bound_params
|
||||
|
@ -296,7 +296,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
||||
// for where the type was defined. On the other
|
||||
// hand, `paths` always has the right
|
||||
// information if present.
|
||||
Some(&(ref fqp, _)) => Some(&fqp[..fqp.len() - 1]),
|
||||
Some((fqp, _)) => Some(&fqp[..fqp.len() - 1]),
|
||||
None => None,
|
||||
};
|
||||
((did, path), true)
|
||||
|
@ -962,7 +962,7 @@ fn fmt_type<'cx>(
|
||||
clean::Tuple(ref typs) => {
|
||||
match &typs[..] {
|
||||
&[] => primitive_link(f, PrimitiveType::Unit, "()", cx),
|
||||
&[ref one] => {
|
||||
[one] => {
|
||||
if let clean::Generic(name) = one {
|
||||
primitive_link(f, PrimitiveType::Tuple, &format!("({name},)"), cx)
|
||||
} else {
|
||||
|
@ -29,7 +29,7 @@ pub(crate) fn build_index<'tcx>(
|
||||
// Attach all orphan items to the type's definition if the type
|
||||
// has since been learned.
|
||||
for &OrphanImplItem { parent, ref item, ref impl_generics } in &cache.orphan_impl_items {
|
||||
if let Some(&(ref fqp, _)) = cache.paths.get(&parent) {
|
||||
if let Some((fqp, _)) = cache.paths.get(&parent) {
|
||||
let desc = item
|
||||
.doc_value()
|
||||
.map_or_else(String::new, |s| short_markdown_summary(&s, &item.link_names(cache)));
|
||||
@ -573,7 +573,7 @@ fn get_fn_inputs_and_outputs<'tcx>(
|
||||
let decl = &func.decl;
|
||||
|
||||
let combined_generics;
|
||||
let (self_, generics) = if let Some(&(ref impl_self, ref impl_generics)) = impl_generics {
|
||||
let (self_, generics) = if let Some((impl_self, impl_generics)) = impl_generics {
|
||||
match (impl_generics.is_empty(), func.generics.is_empty()) {
|
||||
(true, _) => (Some(impl_self), &func.generics),
|
||||
(_, true) => (Some(impl_self), impl_generics),
|
||||
|
Loading…
Reference in New Issue
Block a user