mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Apply first set of Rustfmt edition 2024 changes (#13478)
Rustfmt introduces a lot of formatting changes in the 2024 edition. To not break everything all at once, we split out the set of formatting changes compatible with both the 2021 and 2024 edition by first formatting with the 2024 style, and then again with the currently used 2021 style. Notable changes are the formatting of derive macro attributes and lines with overly long strings and adding trailing semicolons after statements consistently.
This commit is contained in:
parent
b31d08c683
commit
5d37c7ecc5
77 changed files with 660 additions and 313 deletions
|
@ -94,7 +94,9 @@ pub enum Error {
|
|||
Mirror(&'static str, &'static str),
|
||||
#[error(transparent)]
|
||||
LibcDetection(#[from] LibcDetectionError),
|
||||
#[error("Remote python downloads JSON is not yet supported, please use a local path (without `file://` prefix)")]
|
||||
#[error(
|
||||
"Remote python downloads JSON is not yet supported, please use a local path (without `file://` prefix)"
|
||||
)]
|
||||
RemoteJSONNotSupported(),
|
||||
#[error("The json of the python downloads is invalid: {0}")]
|
||||
InvalidPythonDownloadsJSON(String, #[source] serde_json::Error),
|
||||
|
@ -401,7 +403,9 @@ impl From<&ManagedPythonInstallation> for PythonDownloadRequest {
|
|||
Some(VersionRequest::from(&key.version())),
|
||||
match &key.implementation {
|
||||
LenientImplementationName::Known(implementation) => Some(*implementation),
|
||||
LenientImplementationName::Unknown(name) => unreachable!("Managed Python installations are expected to always have known implementation names, found {name}"),
|
||||
LenientImplementationName::Unknown(name) => unreachable!(
|
||||
"Managed Python installations are expected to always have known implementation names, found {name}"
|
||||
),
|
||||
},
|
||||
Some(key.arch),
|
||||
Some(key.os),
|
||||
|
|
|
@ -106,8 +106,15 @@ impl fmt::Display for EnvironmentNotFound {
|
|||
match search_type {
|
||||
// This error message assumes that the relevant API accepts the `--system` flag. This
|
||||
// is true of the callsites today, since the project APIs never surface this error.
|
||||
SearchType::Virtual => write!(f, "; run `{}` to create an environment, or pass `{}` to install into a non-virtual environment", "uv venv".green(), "--system".green())?,
|
||||
SearchType::VirtualOrSystem => write!(f, "; run `{}` to create an environment", "uv venv".green())?,
|
||||
SearchType::Virtual => write!(
|
||||
f,
|
||||
"; run `{}` to create an environment, or pass `{}` to install into a non-virtual environment",
|
||||
"uv venv".green(),
|
||||
"--system".green()
|
||||
)?,
|
||||
SearchType::VirtualOrSystem => {
|
||||
write!(f, "; run `{}` to create an environment", "uv venv".green())?;
|
||||
}
|
||||
SearchType::System => {}
|
||||
}
|
||||
|
||||
|
|
|
@ -740,7 +740,9 @@ enum InterpreterInfoResult {
|
|||
pub enum InterpreterInfoError {
|
||||
#[error("Could not detect a glibc or a musl libc (while running on Linux)")]
|
||||
LibcNotFound,
|
||||
#[error("Broken Python installation, `platform.mac_ver()` returned an empty value, please reinstall Python")]
|
||||
#[error(
|
||||
"Broken Python installation, `platform.mac_ver()` returned an empty value, please reinstall Python"
|
||||
)]
|
||||
BrokenMacVer,
|
||||
#[error("Unknown operating system: `{operating_system}`")]
|
||||
UnknownOperatingSystem { operating_system: String },
|
||||
|
@ -748,7 +750,9 @@ pub enum InterpreterInfoError {
|
|||
UnsupportedPythonVersion { python_version: String },
|
||||
#[error("Python executable does not support `-I` flag. Please use Python 3.8 or newer.")]
|
||||
UnsupportedPython,
|
||||
#[error("Python installation is missing `distutils`, which is required for packaging on older Python versions. Your system may package it separately, e.g., as `python{python_major}-distutils` or `python{python_major}.{python_minor}-distutils`.")]
|
||||
#[error(
|
||||
"Python installation is missing `distutils`, which is required for packaging on older Python versions. Your system may package it separately, e.g., as `python{python_major}-distutils` or `python{python_major}.{python_minor}-distutils`."
|
||||
)]
|
||||
MissingRequiredDistutils {
|
||||
python_major: usize,
|
||||
python_minor: usize,
|
||||
|
|
|
@ -636,12 +636,12 @@ mod tests {
|
|||
})??;
|
||||
assert!(
|
||||
matches!(
|
||||
python,
|
||||
PythonInstallation {
|
||||
source: PythonSource::SearchPath,
|
||||
interpreter: _
|
||||
}
|
||||
),
|
||||
python,
|
||||
PythonInstallation {
|
||||
source: PythonSource::SearchPath,
|
||||
interpreter: _
|
||||
}
|
||||
),
|
||||
"We should skip the Python 2 installation and find the Python 3 interpreter; got {python:?}"
|
||||
);
|
||||
assert_eq!(python.interpreter().sys_executable(), python3.path());
|
||||
|
@ -937,12 +937,12 @@ mod tests {
|
|||
})??;
|
||||
assert!(
|
||||
matches!(
|
||||
python,
|
||||
PythonInstallation {
|
||||
source: PythonSource::SearchPathFirst,
|
||||
interpreter: _
|
||||
}
|
||||
),
|
||||
python,
|
||||
PythonInstallation {
|
||||
source: PythonSource::SearchPathFirst,
|
||||
interpreter: _
|
||||
}
|
||||
),
|
||||
"We should skip the active environment in favor of the requested version; got {python:?}"
|
||||
);
|
||||
|
||||
|
|
|
@ -16,7 +16,9 @@ use uv_fs::Simplified;
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum LibcDetectionError {
|
||||
#[error("Could not detect either glibc version nor musl libc version, at least one of which is required")]
|
||||
#[error(
|
||||
"Could not detect either glibc version nor musl libc version, at least one of which is required"
|
||||
)]
|
||||
NoLibcFound,
|
||||
#[error("Failed to get base name of symbolic link path {0}")]
|
||||
MissingBasePath(PathBuf),
|
||||
|
@ -66,7 +68,9 @@ pub(crate) fn detect_linux_libc() -> Result<LibcVersion, LibcDetectionError> {
|
|||
match detect_linux_libc_from_ld_symlink(&ld_path) {
|
||||
Ok(os) => return Ok(os),
|
||||
Err(err) => {
|
||||
trace!("Tried to find libc version from possible symlink at {ld_path:?}, but failed: {err}");
|
||||
trace!(
|
||||
"Tried to find libc version from possible symlink at {ld_path:?}, but failed: {err}"
|
||||
);
|
||||
}
|
||||
}
|
||||
match detect_glibc_version_from_ldd(&ld_path) {
|
||||
|
|
|
@ -215,7 +215,7 @@ impl ManagedPythonInstallations {
|
|||
return Err(Error::ReadError {
|
||||
dir: self.root.clone(),
|
||||
err,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
let scratch = self.scratch();
|
||||
|
@ -487,7 +487,7 @@ impl ManagedPythonInstallation {
|
|||
);
|
||||
}
|
||||
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||
return Err(Error::MissingExecutable(python.clone()))
|
||||
return Err(Error::MissingExecutable(python.clone()));
|
||||
}
|
||||
Err(err) if err.kind() == io::ErrorKind::AlreadyExists => {}
|
||||
Err(err) => {
|
||||
|
@ -495,7 +495,7 @@ impl ManagedPythonInstallation {
|
|||
from: executable,
|
||||
to: python,
|
||||
err,
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue