mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
clippy: Add safety documentation and clean up unsafe methods (#33748)
This change: 1. Adds safety documentation where it was missing. 2. Limits the scope of unsafe code in some cases to where it is actually unsafe. 3. Converts some free functions to associated functions and methods, thereby making them more likely to be called safely. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
ed959d7a1a
commit
30abb99287
14 changed files with 409 additions and 347 deletions
|
@ -89,12 +89,24 @@ impl<'dom> ServoLayoutElement<'dom> {
|
|||
self.as_node().style_data()
|
||||
}
|
||||
|
||||
/// Unset the snapshot flags on the underlying DOM object for this element.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function accesses and modifies the underlying DOM object and should
|
||||
/// not be used by more than a single thread at once.
|
||||
pub unsafe fn unset_snapshot_flags(&self) {
|
||||
self.as_node()
|
||||
.node
|
||||
.set_flag(NodeFlags::HAS_SNAPSHOT | NodeFlags::HANDLED_SNAPSHOT, false);
|
||||
}
|
||||
|
||||
/// Unset the snapshot flags on the underlying DOM object for this element.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function accesses and modifies the underlying DOM object and should
|
||||
/// not be used by more than a single thread at once.
|
||||
pub unsafe fn set_has_snapshot(&self) {
|
||||
self.as_node().node.set_flag(NodeFlags::HAS_SNAPSHOT, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue