mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Eliminate string match allocation in url.rs
This commit is contained in:
parent
d1f98e0c75
commit
d723798298
1 changed files with 5 additions and 5 deletions
|
@ -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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue