mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Stop allocating in fmt::Write for nsA[C]String
This commit is contained in:
parent
bad77b6a20
commit
47df1375c5
1 changed files with 2 additions and 2 deletions
|
@ -988,7 +988,7 @@ impl From<String> for nsCString {
|
||||||
// Support for the write!() macro for appending to nsACStrings
|
// Support for the write!() macro for appending to nsACStrings
|
||||||
impl fmt::Write for nsACString {
|
impl fmt::Write for nsACString {
|
||||||
fn write_str(&mut self, s: &str) -> Result<(), fmt::Error> {
|
fn write_str(&mut self, s: &str) -> Result<(), fmt::Error> {
|
||||||
self.append(&nsCString::from(s));
|
self.append(s);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1106,7 @@ impl fmt::Write for nsAString {
|
||||||
fn write_str(&mut self, s: &str) -> Result<(), fmt::Error> {
|
fn write_str(&mut self, s: &str) -> Result<(), fmt::Error> {
|
||||||
// Directly invoke gecko's routines for appending utf8 strings to
|
// Directly invoke gecko's routines for appending utf8 strings to
|
||||||
// nsAString values, to avoid as much overhead as possible
|
// nsAString values, to avoid as much overhead as possible
|
||||||
self.append_utf8(&nsCString::from(s));
|
self.append_utf8(s);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue