diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-08-29 12:14:34 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-08-29 12:14:41 +0200 |
| commit | 8683439a20b7bbb96a23751b9010b139809cb236 (patch) | |
| tree | 16f066c7586f2991017214f5a3b4e95caa40fc18 /src/librustdoc/clean/inline.rs | |
| parent | a60a9e567a7319b33619f6551dc29522c6f58687 (diff) | |
| download | rust-8683439a20b7bbb96a23751b9010b139809cb236.tar.gz rust-8683439a20b7bbb96a23751b9010b139809cb236.zip | |
Fix clippy lints
Diffstat (limited to 'src/librustdoc/clean/inline.rs')
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index f8953f0ebcf..962a5a05737 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -54,7 +54,7 @@ pub(crate) fn try_inline( debug!("attrs={attrs:?}"); let attrs_without_docs = attrs.map(|(attrs, def_id)| { - (attrs.into_iter().filter(|a| a.doc_str().is_none()).cloned().collect::<Vec<_>>(), def_id) + (attrs.iter().filter(|a| a.doc_str().is_none()).cloned().collect::<Vec<_>>(), def_id) }); let attrs_without_docs = attrs_without_docs.as_ref().map(|(attrs, def_id)| (&attrs[..], *def_id)); @@ -288,10 +288,7 @@ pub(crate) fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean clean::Trait { def_id: did, generics, items: trait_items, bounds: supertrait_bounds } } -pub(crate) fn build_function<'tcx>( - cx: &mut DocContext<'tcx>, - def_id: DefId, -) -> Box<clean::Function> { +pub(crate) fn build_function(cx: &mut DocContext<'_>, def_id: DefId) -> Box<clean::Function> { let sig = cx.tcx.fn_sig(def_id).instantiate_identity(); // The generics need to be cleaned before the signature. let mut generics = @@ -425,7 +422,7 @@ pub(crate) fn merge_attrs( both.cfg(cx.tcx, &cx.cache.hidden_cfg), ) } else { - (Attributes::from_ast(&old_attrs), old_attrs.cfg(cx.tcx, &cx.cache.hidden_cfg)) + (Attributes::from_ast(old_attrs), old_attrs.cfg(cx.tcx, &cx.cache.hidden_cfg)) } } @@ -791,16 +788,15 @@ fn build_macro( /// implementation for `AssociatedType` fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean::Generics { for pred in &mut g.where_predicates { - match *pred { - clean::WherePredicate::BoundPredicate { ty: clean::SelfTy, ref mut bounds, .. } => { - bounds.retain(|bound| match bound { - clean::GenericBound::TraitBound(clean::PolyTrait { trait_, .. }, _) => { - trait_.def_id() != trait_did - } - _ => true, - }); - } - _ => {} + if let clean::WherePredicate::BoundPredicate { ty: clean::SelfTy, ref mut bounds, .. } = + *pred + { + bounds.retain(|bound| match bound { + clean::GenericBound::TraitBound(clean::PolyTrait { trait_, .. }, _) => { + trait_.def_id() != trait_did + } + _ => true, + }); } } |
