mirror of
https://github.com/servo/servo.git
synced 2025-07-24 07:40:27 +01:00
clippy: fix warnings in various modules in components (#31568)
* clippy: fix warnings in various modules in components * fix: unit tests * fix: build on android * fix: all samplers use new_boxed
This commit is contained in:
parent
19f1f2a8f4
commit
3a5ca785d3
24 changed files with 107 additions and 118 deletions
|
@ -29,16 +29,23 @@ const CHUNK_SIZE: usize = 16;
|
|||
pub type FlowList = SmallVec<[UnsafeFlow; CHUNK_SIZE]>;
|
||||
|
||||
/// Vtable + pointer representation of a Flow trait object.
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
#[derive(Clone, Copy, Eq)]
|
||||
pub struct UnsafeFlow(*const dyn Flow);
|
||||
|
||||
unsafe impl Sync for UnsafeFlow {}
|
||||
unsafe impl Send for UnsafeFlow {}
|
||||
impl PartialEq for UnsafeFlow {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
// Compare the pointers explicitly to avoid clippy lint
|
||||
self.0 as *const u8 == other.0 as *const u8
|
||||
}
|
||||
}
|
||||
|
||||
fn null_unsafe_flow() -> UnsafeFlow {
|
||||
UnsafeFlow(ptr::null::<BlockFlow>())
|
||||
}
|
||||
|
||||
#[allow(clippy::not_unsafe_ptr_arg_deref)] // It has an unsafe block inside
|
||||
pub fn mut_owned_flow_to_unsafe_flow(flow: *mut FlowRef) -> UnsafeFlow {
|
||||
unsafe { UnsafeFlow(&**flow) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue