From fa5a47010737207e104efba04a516affaf739c68 Mon Sep 17 00:00:00 2001 From: Austin Liu Date: Mon, 2 Sep 2024 18:02:20 +0800 Subject: [PATCH] Remove redundant `normalize_url()` Signed-off-by: Austin Liu --- src/upload.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/upload.rs b/src/upload.rs index dbe4e3fb4..267b6ca2c 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -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) { @@ -322,16 +322,8 @@ fn complete_registry(opt: &PublishOpt) -> Result { { 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())