From 95c7e74c0aa279a2e8ceff09a32cf3429598cc6b Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 12 May 2014 14:55:22 -0400 Subject: [PATCH] servo: Merge #2407 - Avoid unnecessary allocations in try_parse_url (from Ms2ger:try_parse_url-owned); r=jdm Source-Repo: https://github.com/servo/servo Source-Revision: 3bb81310d4051c80cb9eec04a8382c95159de970 --- servo/src/components/util/url.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/servo/src/components/util/url.rs b/servo/src/components/util/url.rs index 47c4043b330b..da2ca64c0e0a 100644 --- a/servo/src/components/util/url.rs +++ b/servo/src/components/util/url.rs @@ -18,7 +18,7 @@ Create a URL object from a string. Does various helpful browsery things like */ // TODO: about:failure-> pub fn try_parse_url(str_url: &str, base_url: Option) -> Result { - let str_url = str_url.trim_chars(& &[' ', '\t', '\n', '\r', '\x0C']).to_owned(); + let str_url = str_url.trim_chars(& &[' ', '\t', '\n', '\r', '\x0C']); let schm = std_url::get_scheme(str_url); let str_url = match schm { Err(_) => { @@ -69,7 +69,7 @@ pub fn try_parse_url(str_url: &str, base_url: Option) -> Result str_url + _ => str_url.to_owned() } }, "data" => { @@ -78,7 +78,7 @@ pub fn try_parse_url(str_url: &str, base_url: Option) -> Result str_url + _ => str_url.to_owned() } } };