mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-03 18:38:21 +00:00
Rename Error::IO
to Error::Io
(#5174)
## Summary I believe this is by convention (see, e.g., in Rust itself: https://github.com/search?q=repo%3Arust-lang%2Frust+%2F%28%3F-i%29Io%2F&type=code).
This commit is contained in:
parent
61a81da760
commit
8484611753
11 changed files with 23 additions and 23 deletions
|
@ -169,7 +169,7 @@ impl RequirementsTxt {
|
|||
{
|
||||
return Err(RequirementsTxtFileError {
|
||||
file: requirements_txt.to_path_buf(),
|
||||
error: RequirementsTxtParserError::IO(io::Error::new(
|
||||
error: RequirementsTxtParserError::Io(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
"Remote file not supported without `http` feature",
|
||||
)),
|
||||
|
@ -182,7 +182,7 @@ impl RequirementsTxt {
|
|||
if client_builder.is_offline() {
|
||||
return Err(RequirementsTxtFileError {
|
||||
file: requirements_txt.to_path_buf(),
|
||||
error: RequirementsTxtParserError::IO(io::Error::new(
|
||||
error: RequirementsTxtParserError::Io(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
format!("Network connectivity is disabled, but a remote requirements file was requested: {}", requirements_txt.display()),
|
||||
)),
|
||||
|
@ -196,7 +196,7 @@ impl RequirementsTxt {
|
|||
// Ex) `file:///home/ferris/project/requirements.txt`
|
||||
uv_fs::read_to_string_transcode(&requirements_txt)
|
||||
.await
|
||||
.map_err(RequirementsTxtParserError::IO)
|
||||
.map_err(RequirementsTxtParserError::Io)
|
||||
}
|
||||
.map_err(|err| RequirementsTxtFileError {
|
||||
file: requirements_txt.to_path_buf(),
|
||||
|
@ -800,7 +800,7 @@ pub struct RequirementsTxtFileError {
|
|||
/// Error parsing requirements.txt, error disambiguation
|
||||
#[derive(Debug)]
|
||||
pub enum RequirementsTxtParserError {
|
||||
IO(io::Error),
|
||||
Io(io::Error),
|
||||
Url {
|
||||
source: url::ParseError,
|
||||
url: String,
|
||||
|
@ -877,7 +877,7 @@ pub enum RequirementsTxtParserError {
|
|||
impl Display for RequirementsTxtParserError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::IO(err) => err.fmt(f),
|
||||
Self::Io(err) => err.fmt(f),
|
||||
Self::Url { url, start, .. } => {
|
||||
write!(f, "Invalid URL at position {start}: `{url}`")
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ impl Display for RequirementsTxtParserError {
|
|||
impl std::error::Error for RequirementsTxtParserError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match &self {
|
||||
Self::IO(err) => err.source(),
|
||||
Self::Io(err) => err.source(),
|
||||
Self::Url { source, .. } => Some(source),
|
||||
Self::FileUrl { .. } => None,
|
||||
Self::VerbatimUrl { source, .. } => Some(source),
|
||||
|
@ -971,7 +971,7 @@ impl std::error::Error for RequirementsTxtParserError {
|
|||
impl Display for RequirementsTxtFileError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match &self.error {
|
||||
RequirementsTxtParserError::IO(err) => err.fmt(f),
|
||||
RequirementsTxtParserError::Io(err) => err.fmt(f),
|
||||
RequirementsTxtParserError::Url { url, start, .. } => {
|
||||
write!(
|
||||
f,
|
||||
|
@ -1108,7 +1108,7 @@ impl std::error::Error for RequirementsTxtFileError {
|
|||
|
||||
impl From<io::Error> for RequirementsTxtParserError {
|
||||
fn from(err: io::Error) -> Self {
|
||||
Self::IO(err)
|
||||
Self::Io(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static SETUP_PY_REQUIREMENTS: Lazy<[Requirement; 2]> = Lazy::new(|| {
|
|||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
IO(#[from] io::Error),
|
||||
Io(#[from] io::Error),
|
||||
#[error("Invalid source distribution: {0}")]
|
||||
InvalidSourceDist(String),
|
||||
#[error("Invalid `pyproject.toml`")]
|
||||
|
|
|
@ -149,7 +149,7 @@ pub enum PythonSource {
|
|||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
IO(#[from] io::Error),
|
||||
Io(#[from] io::Error),
|
||||
|
||||
/// An error was encountering when retrieving interpreter information.
|
||||
#[error(transparent)]
|
||||
|
|
|
@ -28,7 +28,7 @@ use crate::{Interpreter, PythonRequest, PythonVersion, VersionRequest};
|
|||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
IO(#[from] io::Error),
|
||||
Io(#[from] io::Error),
|
||||
#[error(transparent)]
|
||||
ImplementationError(#[from] ImplementationError),
|
||||
#[error("Invalid Python version: {0}")]
|
||||
|
|
|
@ -24,7 +24,7 @@ use uv_fs::{LockedFile, Simplified};
|
|||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
IO(#[from] io::Error),
|
||||
Io(#[from] io::Error),
|
||||
#[error(transparent)]
|
||||
Download(#[from] DownloadError),
|
||||
#[error(transparent)]
|
||||
|
|
|
@ -32,12 +32,12 @@ pub struct PyVenvConfiguration {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
#[error("Broken virtualenv `{0}`: `pyvenv.cfg` is missing")]
|
||||
MissingPyVenvCfg(PathBuf),
|
||||
#[error("Broken virtualenv `{0}`: `pyvenv.cfg` could not be parsed")]
|
||||
ParsePyVenvCfg(PathBuf, #[source] io::Error),
|
||||
#[error(transparent)]
|
||||
IO(#[from] io::Error),
|
||||
}
|
||||
|
||||
/// Locate an active virtual environment by inspecting environment variables.
|
||||
|
|
|
@ -30,7 +30,7 @@ mod tool;
|
|||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
IO(#[from] io::Error),
|
||||
Io(#[from] io::Error),
|
||||
#[error("Failed to update `uv-receipt.toml` at {0}")]
|
||||
ReceiptWrite(PathBuf, #[source] Box<toml::ser::Error>),
|
||||
#[error("Failed to read `uv-receipt.toml` at {0}")]
|
||||
|
@ -121,7 +121,7 @@ impl InstalledTools {
|
|||
let path = self.tool_dir(name).join("uv-receipt.toml");
|
||||
match ToolReceipt::from_path(&path) {
|
||||
Ok(tool_receipt) => Ok(Some(tool_receipt.tool)),
|
||||
Err(Error::IO(err)) if err.kind() == io::ErrorKind::NotFound => Ok(None),
|
||||
Err(Error::Io(err)) if err.kind() == io::ErrorKind::NotFound => Ok(None),
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ mod virtualenv;
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
IO(#[from] io::Error),
|
||||
Io(#[from] io::Error),
|
||||
#[error("Failed to determine Python interpreter to use")]
|
||||
Discovery(#[from] uv_python::DiscoveryError),
|
||||
#[error("Failed to determine Python interpreter to use")]
|
||||
|
|
|
@ -86,7 +86,7 @@ pub(crate) fn create(
|
|||
match location.metadata() {
|
||||
Ok(metadata) => {
|
||||
if metadata.is_file() {
|
||||
return Err(Error::IO(io::Error::new(
|
||||
return Err(Error::Io(io::Error::new(
|
||||
io::ErrorKind::AlreadyExists,
|
||||
format!("File exists at `{}`", location.user_display()),
|
||||
)));
|
||||
|
@ -103,7 +103,7 @@ pub(crate) fn create(
|
|||
{
|
||||
info!("Ignoring empty directory");
|
||||
} else {
|
||||
return Err(Error::IO(io::Error::new(
|
||||
return Err(Error::Io(io::Error::new(
|
||||
io::ErrorKind::AlreadyExists,
|
||||
format!(
|
||||
"The directory `{}` exists, but it's not a virtualenv",
|
||||
|
@ -116,7 +116,7 @@ pub(crate) fn create(
|
|||
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||
fs::create_dir_all(location)?;
|
||||
}
|
||||
Err(err) => return Err(Error::IO(err)),
|
||||
Err(err) => return Err(Error::Io(err)),
|
||||
}
|
||||
|
||||
let location = location.canonicalize()?;
|
||||
|
|
|
@ -26,7 +26,7 @@ pub(crate) async fn list(
|
|||
let installed_tools = InstalledTools::from_settings()?;
|
||||
let _lock = match installed_tools.acquire_lock() {
|
||||
Ok(lock) => lock,
|
||||
Err(uv_tool::Error::IO(err)) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
Err(uv_tool::Error::Io(err)) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
writeln!(printer.stderr(), "No tools installed")?;
|
||||
return Ok(ExitStatus::Success);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ pub(crate) async fn uninstall(
|
|||
let installed_tools = InstalledTools::from_settings()?.init()?;
|
||||
let _lock = match installed_tools.acquire_lock() {
|
||||
Ok(lock) => lock,
|
||||
Err(uv_tool::Error::IO(err)) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
Err(uv_tool::Error::Io(err)) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
if let Some(name) = name {
|
||||
bail!("`{name}` is not installed");
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ pub(crate) async fn uninstall(
|
|||
)?;
|
||||
return Ok(ExitStatus::Success);
|
||||
}
|
||||
Err(uv_tool::Error::IO(err)) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
Err(uv_tool::Error::Io(err)) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
bail!("`{name}` is not installed");
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue