From e363b6fcc4ee8d27f9a38b2af229d64b84116965 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 24 Jul 2014 12:36:53 +0200 Subject: [PATCH] Avoid an unnecessary clone of the base URL in parse_html(). --- src/components/script/html/hubbub_html_parser.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index a53acea4115..8b7ee5440b7 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -319,7 +319,7 @@ pub fn parse_html(page: &Page, debug!("Fetched page; metadata is {:?}", load_response.metadata); - let base_url = load_response.metadata.final_url.clone(); + let base_url = &load_response.metadata.final_url; { // Store the final URL before we start parsing, so that DOM routines @@ -414,7 +414,7 @@ pub fn parse_html(page: &Page, s.as_slice().eq_ignore_ascii_case("stylesheet") }) => { debug!("found CSS stylesheet: {:s}", *href); - match UrlParser::new().base_url(&base_url).parse(href.as_slice()) { + match UrlParser::new().base_url(base_url).parse(href.as_slice()) { Ok(url) => css_chan2.send(CSSTaskNewFile( UrlProvenance(url, resource_task.clone()))), Err(e) => debug!("Parsing url {:s} failed: {:s}", *href, e) @@ -498,7 +498,7 @@ pub fn parse_html(page: &Page, match script.get_attribute(Null, "src").root() { Some(src) => { debug!("found script: {:s}", src.deref().Value()); - match UrlParser::new().base_url(&base_url) + match UrlParser::new().base_url(base_url) .parse(src.deref().value().as_slice()) { Ok(new_url) => js_chan2.send(JSTaskNewFile(new_url)), Err(e) => debug!("Parsing url {:s} failed: {:s}", src.deref().Value(), e)