1
Fork 0

Rollup merge of #123188 - klensy:clippy-me2, r=Nilstrieb

compiler: fix few unused_peekable and needless_pass_by_ref_mut clippy lints

This fixes few instances of `unused_peekable` and `needless_pass_by_ref_mut`. While i expected to fix more warnings, `needless_pass_by_ref_mut` produced too much for one PR, so i stopped here.

Better reviewed commit by commit, as fixes splitted by chunks.
This commit is contained in:
Matthias Krüger 2024-03-29 15:17:11 +01:00 committed by GitHub
commit 8d820c0c47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 111 additions and 120 deletions

View file

@ -4931,7 +4931,7 @@ fn point_at_assoc_type_restriction<G: EmissionGuarantee>(
let hir::WherePredicate::BoundPredicate(pred) = pred else {
continue;
};
let mut bounds = pred.bounds.iter().peekable();
let mut bounds = pred.bounds.iter();
while let Some(bound) = bounds.next() {
let Some(trait_ref) = bound.trait_ref() else {
continue;

View file

@ -508,7 +508,7 @@ pub(super) fn opt_normalize_projection_type<'a, 'b, 'tcx>(
/// because it contains `[type error]`. Yuck! (See issue #29857 for
/// one case where this arose.)
fn normalize_to_error<'a, 'tcx>(
selcx: &mut SelectionContext<'a, 'tcx>,
selcx: &SelectionContext<'a, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
projection_ty: ty::AliasTy<'tcx>,
cause: ObligationCause<'tcx>,

View file

@ -239,10 +239,10 @@ fn fulfill_implication<'tcx>(
let source_trait = ImplSubject::Trait(source_trait_ref);
let selcx = &mut SelectionContext::new(infcx);
let selcx = SelectionContext::new(infcx);
let target_args = infcx.fresh_args_for_item(DUMMY_SP, target_impl);
let (target_trait, obligations) =
util::impl_subject_and_oblig(selcx, param_env, target_impl, target_args, error_cause);
util::impl_subject_and_oblig(&selcx, param_env, target_impl, target_args, error_cause);
// do the impls unify? If not, no specialization.
let Ok(InferOk { obligations: more_obligations, .. }) = infcx

View file

@ -198,7 +198,7 @@ impl<'tcx> Children {
}
}
fn iter_children(children: &mut Children) -> impl Iterator<Item = DefId> + '_ {
fn iter_children(children: &Children) -> impl Iterator<Item = DefId> + '_ {
let nonblanket = children.non_blanket_impls.iter().flat_map(|(_, v)| v.iter());
children.blanket_impls.iter().chain(nonblanket).cloned()
}

View file

@ -205,7 +205,7 @@ impl Iterator for SupertraitDefIds<'_> {
/// returning the resulting subject and all obligations that arise.
/// The obligations are closed under normalization.
pub fn impl_subject_and_oblig<'a, 'tcx>(
selcx: &mut SelectionContext<'a, 'tcx>,
selcx: &SelectionContext<'a, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
impl_def_id: DefId,
impl_args: GenericArgsRef<'tcx>,