From cc96efd7e30c92ff5135fbda2273ef86f4be6937 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 6 Aug 2024 11:54:45 -0400 Subject: [PATCH] Stop unnecessarily taking GenericPredicates by &self --- compiler/rustc_middle/src/ty/generics.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs index 39c306a720f..8cb8e9af11c 100644 --- a/compiler/rustc_middle/src/ty/generics.rs +++ b/compiler/rustc_middle/src/ty/generics.rs @@ -376,7 +376,7 @@ pub struct GenericPredicates<'tcx> { impl<'tcx> GenericPredicates<'tcx> { pub fn instantiate( - &self, + self, tcx: TyCtxt<'tcx>, args: GenericArgsRef<'tcx>, ) -> InstantiatedPredicates<'tcx> { @@ -386,20 +386,20 @@ pub fn instantiate( } pub fn instantiate_own( - &self, + self, tcx: TyCtxt<'tcx>, args: GenericArgsRef<'tcx>, ) -> impl Iterator, Span)> + DoubleEndedIterator + ExactSizeIterator { EarlyBinder::bind(self.predicates).iter_instantiated_copied(tcx, args) } - pub fn instantiate_own_identity(&self) -> impl Iterator, Span)> { + pub fn instantiate_own_identity(self) -> impl Iterator, Span)> { EarlyBinder::bind(self.predicates).iter_identity_copied() } #[instrument(level = "debug", skip(self, tcx))] fn instantiate_into( - &self, + self, tcx: TyCtxt<'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>, args: GenericArgsRef<'tcx>, @@ -413,14 +413,14 @@ fn instantiate_into( instantiated.spans.extend(self.predicates.iter().map(|(_, sp)| *sp)); } - pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx>) -> InstantiatedPredicates<'tcx> { + pub fn instantiate_identity(self, tcx: TyCtxt<'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_identity_into(tcx, &mut instantiated); instantiated } fn instantiate_identity_into( - &self, + self, tcx: TyCtxt<'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>, ) {