mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-02 04:48:18 +00:00
Make the use of Self consistent. (#15074)
## Summary Make the use of `Self` consistent. Mostly done by running `cargo clippy --fix -- -A clippy::all -W clippy::use_self`. ## Test Plan <!-- How was it tested? --> No need.
This commit is contained in:
parent
57f900ad0d
commit
3f83390e34
121 changed files with 1305 additions and 1376 deletions
|
|
@ -1051,7 +1051,7 @@ pub struct ManagedClient<'a> {
|
|||
|
||||
impl<'a> ManagedClient<'a> {
|
||||
/// Create a new `ManagedClient` using the given client and concurrency limit.
|
||||
fn new(client: &'a RegistryClient, concurrency: usize) -> ManagedClient<'a> {
|
||||
fn new(client: &'a RegistryClient, concurrency: usize) -> Self {
|
||||
ManagedClient {
|
||||
unmanaged: client,
|
||||
control: Semaphore::new(concurrency),
|
||||
|
|
@ -1176,7 +1176,7 @@ impl LocalArchivePointer {
|
|||
/// Read an [`LocalArchivePointer`] from the cache.
|
||||
pub fn read_from(path: impl AsRef<Path>) -> Result<Option<Self>, Error> {
|
||||
match fs_err::read(path) {
|
||||
Ok(cached) => Ok(Some(rmp_serde::from_slice::<LocalArchivePointer>(&cached)?)),
|
||||
Ok(cached) => Ok(Some(rmp_serde::from_slice::<Self>(&cached)?)),
|
||||
Err(err) if err.kind() == io::ErrorKind::NotFound => Ok(None),
|
||||
Err(err) => Err(Error::CacheRead(err)),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ impl Hashed for LocalWheel {
|
|||
|
||||
/// Convert a [`LocalWheel`] into a [`CachedDist`].
|
||||
impl From<LocalWheel> for CachedDist {
|
||||
fn from(wheel: LocalWheel) -> CachedDist {
|
||||
CachedDist::from_remote(
|
||||
fn from(wheel: LocalWheel) -> Self {
|
||||
Self::from_remote(
|
||||
wheel.dist,
|
||||
wheel.filename,
|
||||
wheel.hashes,
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ impl Error {
|
|||
distribution: String,
|
||||
expected: &[HashDigest],
|
||||
actual: &[HashDigest],
|
||||
) -> Error {
|
||||
) -> Self {
|
||||
match (expected.is_empty(), actual.is_empty()) {
|
||||
(true, true) => Self::MissingHashes { distribution },
|
||||
(true, false) => {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ impl LoweredRequirement {
|
|||
let mut remaining = total.negate();
|
||||
remaining.and(requirement.marker);
|
||||
|
||||
LoweredRequirement(Requirement {
|
||||
Self(Requirement {
|
||||
marker: remaining,
|
||||
..Requirement::from(requirement.clone())
|
||||
})
|
||||
|
|
@ -389,7 +389,7 @@ impl LoweredRequirement {
|
|||
let mut remaining = total.negate();
|
||||
remaining.and(requirement.marker);
|
||||
|
||||
LoweredRequirement(Requirement {
|
||||
Self(Requirement {
|
||||
marker: remaining,
|
||||
..Requirement::from(requirement.clone())
|
||||
})
|
||||
|
|
@ -565,10 +565,10 @@ pub enum SourceKind {
|
|||
impl std::fmt::Display for SourceKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
SourceKind::Path => write!(f, "path"),
|
||||
SourceKind::Url => write!(f, "URL"),
|
||||
SourceKind::Git => write!(f, "Git"),
|
||||
SourceKind::Registry => write!(f, "registry"),
|
||||
Self::Path => write!(f, "path"),
|
||||
Self::Url => write!(f, "URL"),
|
||||
Self::Git => write!(f, "Git"),
|
||||
Self::Registry => write!(f, "registry"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2889,9 +2889,7 @@ impl LocalRevisionPointer {
|
|||
/// Read an [`LocalRevisionPointer`] from the cache.
|
||||
pub(crate) fn read_from(path: impl AsRef<Path>) -> Result<Option<Self>, Error> {
|
||||
match fs_err::read(path) {
|
||||
Ok(cached) => Ok(Some(rmp_serde::from_slice::<LocalRevisionPointer>(
|
||||
&cached,
|
||||
)?)),
|
||||
Ok(cached) => Ok(Some(rmp_serde::from_slice::<Self>(&cached)?)),
|
||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),
|
||||
Err(err) => Err(Error::CacheRead(err)),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue