From c7f094e59d67c75bae58fe44891fcf8bd5a4f773 Mon Sep 17 00:00:00 2001 From: Richard Walters Date: Mon, 21 Dec 2020 16:00:27 -0800 Subject: Fix compiler warning --- src/uri.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uri.rs b/src/uri.rs index f318bf6..5f72d76 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -689,10 +689,9 @@ impl Uri { { // Split authority from path. If there is an authority, parse it. let authority_and_path_string = authority_and_path_string.as_ref(); - if authority_and_path_string.starts_with("//") { - // Strip off authority marker. - let authority_and_path_string = &authority_and_path_string[2..]; - + if let Some(authority_and_path_string) = + authority_and_path_string.strip_prefix("//") + { // First separate the authority from the path. let authority_end = authority_and_path_string .find('/') -- cgit v1.2.3