mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
script: Wrap unsafe code in components/script/bindings
in unsafe {}
(#38544)
Clippy now checks to see if unsafe code is wrapped in unsafe blocks. We have this lint disabled for `script` and `script_bindings` because of a lot of legacy code that doesn't do this. The lint is useful though as it makes it more obvious what code is unsafe. This is an incremental step toward being able to turn this lint on for `script`. This has the benefit of silencing warnings that show up in some IDEs that use rust-analyzer. Testing: This should not change behavior at all and is thus covered by existing tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
fef104cff7
commit
931025c16e
13 changed files with 147 additions and 114 deletions
|
@ -54,7 +54,7 @@ use crate::task::TaskBox;
|
|||
|
||||
unsafe impl<T: CustomTraceable> CustomTraceable for DomRefCell<T> {
|
||||
unsafe fn trace(&self, trc: *mut JSTracer) {
|
||||
(*self).borrow().trace(trc)
|
||||
unsafe { (*self).borrow().trace(trc) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ unsafe impl<K, V: JSTraceable, S> JSTraceable for HashMapTracedValues<K, V, S> {
|
|||
#[inline]
|
||||
unsafe fn trace(&self, trc: *mut ::js::jsapi::JSTracer) {
|
||||
for v in self.0.values() {
|
||||
v.trace(trc);
|
||||
unsafe { v.trace(trc) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ pub(crate) fn trace_string(tracer: *mut JSTracer, description: &str, s: &Heap<*m
|
|||
|
||||
unsafe impl<T: JSTraceable> JSTraceable for DomRefCell<T> {
|
||||
unsafe fn trace(&self, trc: *mut JSTracer) {
|
||||
(*self).borrow().trace(trc)
|
||||
unsafe { (*self).borrow().trace(trc) };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue