mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Remove the implementation OptionalSettable for Option<JS<T>> to remove needless '&mut self'.
This commit is contained in:
parent
a0a0e07f71
commit
ad22b29b2d
1 changed files with 3 additions and 11 deletions
|
@ -260,20 +260,12 @@ impl<T: Reflectable> Assignable<T> for Temporary<T> {
|
|||
/// Assign an optional rootable value (either of JS<T> or Temporary<T>) to an optional
|
||||
/// field of a DOM type (ie. Option<JS<T>>)
|
||||
pub trait OptionalSettable<T> {
|
||||
fn assign(&mut self, val: Option<T>);
|
||||
}
|
||||
|
||||
impl<T: Assignable<U>, U: Reflectable> OptionalSettable<T> for Option<JS<U>> {
|
||||
fn assign(&mut self, val: Option<T>) {
|
||||
*self = val.map(|val| unsafe { val.get_js() });
|
||||
}
|
||||
fn assign(&self, val: Option<T>);
|
||||
}
|
||||
|
||||
impl<T: Assignable<U>, U: Reflectable> OptionalSettable<T> for Cell<Option<JS<U>>> {
|
||||
fn assign(&mut self, val: Option<T>) {
|
||||
let mut item = self.get();
|
||||
item.assign(val);
|
||||
self.set(item);
|
||||
fn assign(&self, val: Option<T>) {
|
||||
self.set(val.map(|val| unsafe { val.get_js() }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue