Skip to content

Commit

Permalink
Remove redundant normalize_url()
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Liu <austin362667@gmail.com>
  • Loading branch information
austin362667 committed Sep 2, 2024
1 parent e48c35a commit fa5a470
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ pub struct PublishOpt {
}

impl PublishOpt {
const DEFAULT_REPOSITORY_URL: &'static str = "https://upload.pypi.org/legacy/";
const TEST_REPOSITORY_URL: &'static str = "https://test.pypi.org/legacy/";
const DEFAULT_REPOSITORY_URL: &'static str = "https://upload.pypi.org/legacy";
const TEST_REPOSITORY_URL: &'static str = "https://test.pypi.org/legacy";

/// Set to non interactive mode if we're running on CI
pub fn non_interactive_on_ci(&mut self) {
Expand Down Expand Up @@ -322,16 +322,8 @@ fn complete_registry(opt: &PublishOpt) -> Result<Registry> {
{
let normalized_url = PublishOpt::normalize_url(repository_url);
let name = match normalized_url {
normalized
if normalized == PublishOpt::normalize_url(PublishOpt::DEFAULT_REPOSITORY_URL) =>
{
Some("pypi")
}
normalized
if normalized == PublishOpt::normalize_url(PublishOpt::TEST_REPOSITORY_URL) =>
{
Some("testpypi")
}
normalized if normalized == PublishOpt::DEFAULT_REPOSITORY_URL => Some("pypi"),
normalized if normalized == PublishOpt::TEST_REPOSITORY_URL => Some("testpypi"),
_ => None,
};
(name, repository_url.to_string())
Expand Down

0 comments on commit fa5a470

Please sign in to comment.