mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +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
|
@ -604,7 +604,7 @@ unsafe impl<T> crate::dom::bindings::trace::JSTraceable for HeapBufferSource<T>
|
|||
unsafe fn trace(&self, tracer: *mut js::jsapi::JSTracer) {
|
||||
match &self.buffer_source {
|
||||
BufferSource::ArrayBufferView(buffer) | BufferSource::ArrayBuffer(buffer) => {
|
||||
buffer.trace(tracer);
|
||||
unsafe { buffer.trace(tracer) };
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -879,7 +879,7 @@ impl DataBlock {
|
|||
// the exact same line to fix it. Doing the cast is tricky because of the use of
|
||||
// a generic type in this parameter.
|
||||
#[allow(clippy::from_raw_with_void_ptr)]
|
||||
drop(Arc::from_raw(free_user_data as *const _));
|
||||
drop(unsafe { Arc::from_raw(free_user_data as *const _) });
|
||||
}
|
||||
let raw: *mut Box<[u8]> = Arc::into_raw(Arc::clone(&self.data)) as _;
|
||||
rooted!(in(*cx) let object = unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue