From 5a9f01ee6219028f5fabc193b2dd79cb1540ea88 Mon Sep 17 00:00:00 2001 From: ivila <390810839@qq.com> Date: Wed, 20 Nov 2024 08:55:48 +0800 Subject: [PATCH] PR fix: fix comments --- src/url.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/url.rs b/src/url.rs index e37505c..5947d63 100644 --- a/src/url.rs +++ b/src/url.rs @@ -49,7 +49,7 @@ pub struct HttpUrl { impl HttpUrl { pub fn port(&self) -> u16 { - // this should always go to the happy path as we only have scheme of http and https + // this will never fail because we verified the scheme is HTTP or HTTPS which should always have a port self.url.port_or_known_default().unwrap() } pub fn scheme(&self) -> Scheme { @@ -78,7 +78,7 @@ impl TryFrom for HttpUrl { if scheme != Scheme::Http && scheme != Scheme::Https { return Err(error_unsupported_url_scheme(url.scheme())); }; - // host must exist in http and https, and url crate ensure about it, see test check_url_must_have_host + // HTTP and HTTPS URLs must always have a host, see the check_url_must_have_host test let host = url.host_str().unwrap(); Ok(Self { scheme,