UniqueId uses unsafe code to implement a lazily-created value, but its only use is in code that already lazily creates it and immediately gets the value contained within it:
|
pub fn unique_id(&self) -> String { |
|
let mut rare_data = self.ensure_rare_data(); |
|
|
|
if rare_data.unique_id.is_none() { |
|
let id = UniqueId::new(); |
|
ScriptThread::save_node_id(id.borrow().to_simple().to_string()); |
|
rare_data.unique_id = Some(id); |
|
} |
|
rare_data |
|
.unique_id |
|
.as_ref() |
|
.unwrap() |
|
.borrow() |
|
.to_simple() |
|
.to_string() |
|
} |
We should remove the concept of UniqueId and just inline the relevant types in the unique_id field definition.
UniqueId uses unsafe code to implement a lazily-created value, but its only use is in code that already lazily creates it and immediately gets the value contained within it:
servo/components/script/dom/node.rs
Lines 1076 to 1091 in ffccc5c
We should remove the concept of UniqueId and just inline the relevant types in the unique_id field definition.