Apply some Edition 2024 fixes (#13479)

Some `ref`-removal and `use<>` fixes for the Rust Edition 2024
migration, which are also compatible with Rust Edition 2021.
This commit is contained in:
konsti
2025-05-16 10:34:22 +02:00
committed by GitHub
parent 0baa376627
commit 23261b7e2e
17 changed files with 51 additions and 53 deletions
+1 -1
View File
@@ -563,7 +563,7 @@ fn find_all_minor(
implementation: Option<&ImplementationName>,
version_request: &VersionRequest,
dir: &Path,
) -> impl Iterator<Item = PathBuf> {
) -> impl Iterator<Item = PathBuf> + use<> {
match version_request {
&VersionRequest::Any
| VersionRequest::Default
+4 -4
View File
@@ -268,10 +268,10 @@ impl PythonDownloadRequest {
}
/// Iterate over all [`PythonDownload`]'s that match this request.
pub fn iter_downloads(
&self,
python_downloads_json_url: Option<&str>,
) -> Result<impl Iterator<Item = &'static ManagedPythonDownload> + use<'_>, Error> {
pub fn iter_downloads<'a>(
&'a self,
python_downloads_json_url: Option<&'a str>,
) -> Result<impl Iterator<Item = &'static ManagedPythonDownload> + use<'a>, Error> {
Ok(ManagedPythonDownload::iter_all(python_downloads_json_url)?
.filter(move |download| self.satisfied_by_download(download)))
}
+3 -3
View File
@@ -191,7 +191,7 @@ impl ManagedPythonInstallations {
/// This ensures a consistent ordering across all platforms.
pub fn find_all(
&self,
) -> Result<impl DoubleEndedIterator<Item = ManagedPythonInstallation>, Error> {
) -> Result<impl DoubleEndedIterator<Item = ManagedPythonInstallation> + use<>, Error> {
let dirs = match fs_err::read_dir(&self.root) {
Ok(installation_dirs) => {
// Collect sorted directory paths; `read_dir` is not stable across platforms
@@ -243,7 +243,7 @@ impl ManagedPythonInstallations {
/// Iterate over Python installations that support the current platform.
pub fn find_matching_current_platform(
&self,
) -> Result<impl DoubleEndedIterator<Item = ManagedPythonInstallation>, Error> {
) -> Result<impl DoubleEndedIterator<Item = ManagedPythonInstallation> + use<>, Error> {
let os = Os::from_env();
let arch = Arch::from_env();
let libc = Libc::from_env()?;
@@ -269,7 +269,7 @@ impl ManagedPythonInstallations {
/// - The platform metadata cannot be read
/// - A directory for the installation cannot be read
pub fn find_version<'a>(
&self,
&'a self,
version: &'a PythonVersion,
) -> Result<impl DoubleEndedIterator<Item = ManagedPythonInstallation> + 'a, Error> {
Ok(self