mirror of
https://github.com/astral-sh/uv.git
synced 2025-12-15 22:14:06 +00:00
Use shortened anyhow::Result everywhere (#457)
This commit is contained in:
parent
380030bb5c
commit
3df3110800
3 changed files with 9 additions and 7 deletions
|
|
@ -3,7 +3,7 @@ use std::io::{BufWriter, Write};
|
|||
use std::path::PathBuf;
|
||||
|
||||
use anstream::println;
|
||||
use anyhow::Context;
|
||||
use anyhow::{Context, Result};
|
||||
use clap::{Parser, ValueEnum};
|
||||
use fs_err::File;
|
||||
use itertools::Itertools;
|
||||
|
|
@ -41,7 +41,7 @@ pub(crate) struct ResolveCliArgs {
|
|||
cache_args: CacheArgs,
|
||||
}
|
||||
|
||||
pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> anyhow::Result<()> {
|
||||
pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
|
||||
let cache_dir = CacheDir::try_from(args.cache_args)?;
|
||||
|
||||
let platform = Platform::current()?;
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ pub(crate) async fn resolve_many(args: ResolveManyArgs) -> Result<()> {
|
|||
let data = fs::read_to_string(&args.list)?;
|
||||
let lines = data.lines().map(Requirement::from_str);
|
||||
let requirements: Vec<Requirement> = if let Some(limit) = args.limit {
|
||||
lines.take(limit).collect::<anyhow::Result<_, _>>()?
|
||||
lines.take(limit).collect::<Result<_, _>>()?
|
||||
} else {
|
||||
lines.collect::<anyhow::Result<_, _>>()?
|
||||
lines.collect::<Result<_, _>>()?
|
||||
};
|
||||
|
||||
let platform = Platform::current()?;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ use std::future::Future;
|
|||
use std::path::Path;
|
||||
use std::pin::Pin;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use pep508_rs::Requirement;
|
||||
use puffin_interpreter::{InterpreterInfo, Virtualenv};
|
||||
|
||||
|
|
@ -68,7 +70,7 @@ pub trait BuildContext {
|
|||
fn resolve<'a>(
|
||||
&'a self,
|
||||
requirements: &'a [Requirement],
|
||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<Vec<Requirement>>> + Send + 'a>>;
|
||||
) -> Pin<Box<dyn Future<Output = Result<Vec<Requirement>>> + Send + 'a>>;
|
||||
|
||||
/// Install the given set of package versions into the virtual environment. The environment must
|
||||
/// use the same base python as [`BuildContext::base_python`]
|
||||
|
|
@ -76,7 +78,7 @@ pub trait BuildContext {
|
|||
&'a self,
|
||||
requirements: &'a [Requirement],
|
||||
venv: &'a Virtualenv,
|
||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<()>> + Send + 'a>>;
|
||||
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>;
|
||||
|
||||
/// Build a source distribution into a wheel from an archive.
|
||||
///
|
||||
|
|
@ -89,5 +91,5 @@ pub trait BuildContext {
|
|||
subdirectory: Option<&'a Path>,
|
||||
wheel_dir: &'a Path,
|
||||
package_id: &'a str,
|
||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<String>> + Send + 'a>>;
|
||||
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue