mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
script_bindings: Eliminate DOMString::from_string (#43089)
This method is the same as `DOMString::from` with a `String` argument and `From` and `Into` are preferred when writing modern Rust. Testing: This should not change behavior and is thus covered by existing tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
@@ -145,10 +145,8 @@ impl HTMLProgressElementMethods<crate::DomTypeHolder> for HTMLProgressElement {
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-progress-value>
|
||||
fn SetValue(&self, new_val: Finite<f64>, can_gc: CanGc) {
|
||||
if *new_val >= 0.0 {
|
||||
let mut string_value = DOMString::from_string((*new_val).to_string());
|
||||
|
||||
let mut string_value = DOMString::from((*new_val).to_string());
|
||||
string_value.set_best_representation_of_the_floating_point_number();
|
||||
|
||||
self.upcast::<Element>().set_string_attribute(
|
||||
&local_name!("value"),
|
||||
string_value,
|
||||
@@ -177,10 +175,8 @@ impl HTMLProgressElementMethods<crate::DomTypeHolder> for HTMLProgressElement {
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-progress-max>
|
||||
fn SetMax(&self, new_val: Finite<f64>, can_gc: CanGc) {
|
||||
if *new_val > 0.0 {
|
||||
let mut string_value = DOMString::from_string((*new_val).to_string());
|
||||
|
||||
let mut string_value = DOMString::from((*new_val).to_string());
|
||||
string_value.set_best_representation_of_the_floating_point_number();
|
||||
|
||||
self.upcast::<Element>().set_string_attribute(
|
||||
&local_name!("max"),
|
||||
string_value,
|
||||
|
||||
Reference in New Issue
Block a user