mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Remove macro impl_rare_data (#36771)
This macro does not hide any complex or unsafe implementation details, and, it's only used in two files (node.rs and element.rs). This patch removes the macro, and move the implementation in place. Moreover, the Element::rare_data_mut function in element.rs is called by other functions, so the #[allow(dead_code)] annotation is removed. The Node::rare_data_mut function in node.rs is not called anywhere, so it is removed. Testing: No test is needed for this cleaning up. Fixes: #36767 --------- Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
parent
c98cf8b306
commit
5c5da6071e
3 changed files with 26 additions and 25 deletions
|
@ -327,7 +327,21 @@ impl Element {
|
|||
)
|
||||
}
|
||||
|
||||
impl_rare_data!(ElementRareData);
|
||||
fn rare_data(&self) -> Ref<Option<Box<ElementRareData>>> {
|
||||
self.rare_data.borrow()
|
||||
}
|
||||
|
||||
fn rare_data_mut(&self) -> RefMut<Option<Box<ElementRareData>>> {
|
||||
self.rare_data.borrow_mut()
|
||||
}
|
||||
|
||||
fn ensure_rare_data(&self) -> RefMut<Box<ElementRareData>> {
|
||||
let mut rare_data = self.rare_data.borrow_mut();
|
||||
if rare_data.is_none() {
|
||||
*rare_data = Some(Default::default());
|
||||
}
|
||||
RefMut::map(rare_data, |rare_data| rare_data.as_mut().unwrap())
|
||||
}
|
||||
|
||||
pub(crate) fn restyle(&self, damage: NodeDamage) {
|
||||
let doc = self.node.owner_doc();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue