mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Remove null_str_as_empty and null_str_as_empty_ref functions.
With just one caller between the two functions, there doesn't seem to be much point in having the abstraction.
This commit is contained in:
parent
3ece6bc166
commit
5149f0e953
2 changed files with 2 additions and 18 deletions
|
@ -19,22 +19,6 @@ pub type DOMString = String;
|
|||
pub type StaticCharVec = &'static [char];
|
||||
pub type StaticStringVec = &'static [&'static str];
|
||||
|
||||
pub fn null_str_as_empty(s: &Option<DOMString>) -> DOMString {
|
||||
// We don't use map_default because it would allocate "".to_owned() even
|
||||
// for Some.
|
||||
match *s {
|
||||
Some(ref s) => s.clone(),
|
||||
None => "".to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn null_str_as_empty_ref<'a>(s: &'a Option<DOMString>) -> &'a str {
|
||||
match *s {
|
||||
Some(ref s) => s,
|
||||
None => ""
|
||||
}
|
||||
}
|
||||
|
||||
/// Whitespace as defined by HTML5 § 2.4.1.
|
||||
// TODO(SimonSapin) Maybe a custom Pattern can be more efficient?
|
||||
const WHITESPACE: &'static [char] = &[' ', '\t', '\x0a', '\x0c', '\x0d'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue