Eliminate string match allocation in url.rs

This commit is contained in:
Keegan McAllister 2014-01-08 15:02:29 -08:00
parent d1f98e0c75
commit d723798298

View file

@ -56,10 +56,10 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
} }
}, },
Ok((scheme, page)) => { Ok((scheme, page)) => {
match scheme { match scheme.as_slice() {
~"about" => { "about" => {
match page { match page.as_slice() {
~"failure" => { "failure" => {
let mut path = os::getcwd(); let mut path = os::getcwd();
path.push("../src/test/html/failure.html"); path.push("../src/test/html/failure.html");
// FIXME (#1094): not the right way to transform a path // FIXME (#1094): not the right way to transform a path
@ -69,7 +69,7 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
_ => str_url _ => str_url
} }
}, },
~"data" => { "data" => {
// Drop whitespace within data: URLs, e.g. newlines within a base64 // Drop whitespace within data: URLs, e.g. newlines within a base64
// src="..." block. Whitespace intended as content should be // src="..." block. Whitespace intended as content should be
// %-encoded or base64'd. // %-encoded or base64'd.