From 22dbc79994ec75b8afeeee551ff73924a92d97e3 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 27 May 2024 15:48:58 -0400 Subject: [PATCH] Use consistent argument ordering for `Dist` conversions (#3868) --- crates/distribution-types/src/lib.rs | 8 ++++---- crates/uv-requirements/src/lookahead.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/distribution-types/src/lib.rs b/crates/distribution-types/src/lib.rs index e71f4c553..dd64687f8 100644 --- a/crates/distribution-types/src/lib.rs +++ b/crates/distribution-types/src/lib.rs @@ -287,9 +287,9 @@ impl Dist { /// URL. pub fn from_http_url( name: PackageName, + url: VerbatimUrl, location: Url, subdirectory: Option, - url: VerbatimUrl, ) -> Result { if Path::new(url.path()) .extension() @@ -323,9 +323,9 @@ impl Dist { /// A local built or source distribution from a `file://` URL. pub fn from_file_url( name: PackageName, + url: VerbatimUrl, path: &Path, editable: bool, - url: VerbatimUrl, ) -> Result { // Store the canonicalized path, which also serves to validate that it exists. let path = match path.canonicalize() { @@ -399,9 +399,9 @@ impl Dist { pub fn from_url(name: PackageName, url: VerbatimParsedUrl) -> Result { match url.parsed_url { ParsedUrl::Archive(archive) => { - Self::from_http_url(name, archive.url, archive.subdirectory, url.verbatim) + Self::from_http_url(name, url.verbatim, archive.url, archive.subdirectory) } - ParsedUrl::Path(file) => Self::from_file_url(name, &file.path, false, url.verbatim), + ParsedUrl::Path(file) => Self::from_file_url(name, url.verbatim, &file.path, false), ParsedUrl::Git(git) => { Self::from_git_url(name, url.verbatim, git.url, git.subdirectory) } diff --git a/crates/uv-requirements/src/lookahead.rs b/crates/uv-requirements/src/lookahead.rs index 492f07765..848185be4 100644 --- a/crates/uv-requirements/src/lookahead.rs +++ b/crates/uv-requirements/src/lookahead.rs @@ -160,7 +160,7 @@ impl<'a, Context: BuildContext> LookaheadResolver<'a, Context> { subdirectory, location, url, - } => Dist::from_http_url(requirement.name, location, subdirectory, url)?, + } => Dist::from_http_url(requirement.name, url, location, subdirectory)?, RequirementSource::Git { repository, reference, @@ -184,7 +184,7 @@ impl<'a, Context: BuildContext> LookaheadResolver<'a, Context> { url, // TODO(konsti): Figure out why we lose the editable here (does it matter?) editable: _, - } => Dist::from_file_url(requirement.name, &path, false, url)?, + } => Dist::from_file_url(requirement.name, url, &path, false)?, }; // Fetch the metadata for the distribution.