mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix some Clippy lints.
This commit is contained in:
parent
c23adde5a3
commit
3e5cd8815d
14 changed files with 37 additions and 43 deletions
|
@ -36,12 +36,11 @@ mod platform {
|
|||
|
||||
#[inline]
|
||||
pub unsafe fn alloc(size: usize, align: usize) -> *mut u8 {
|
||||
let ptr = if align <= MIN_ALIGN {
|
||||
if align <= MIN_ALIGN {
|
||||
libc::malloc(size) as *mut u8
|
||||
} else {
|
||||
aligned_malloc(size, align)
|
||||
};
|
||||
ptr
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -49,6 +49,7 @@ impl<T: 'static> Shared<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::mut_from_ref)]
|
||||
pub unsafe fn as_mut(&self) -> &mut T {
|
||||
&mut *self.ptr.as_ptr()
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ impl SafeHash {
|
|||
// effectively reducing the hashes by one bit.
|
||||
//
|
||||
// Truncate hash to fit in `HashUint`.
|
||||
let hash_bits = size_of::<HashUint>() * 8;
|
||||
let hash_bits = HashUint::BITS;
|
||||
SafeHash {
|
||||
hash: (1 << (hash_bits - 1)) | (hash as HashUint),
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ impl<K, V> RawBucket<K, V> {
|
|||
self.hash_start.offset(self.idx as isize)
|
||||
}
|
||||
unsafe fn pair(&self) -> *mut (K, V) {
|
||||
self.pair_start.offset(self.idx as isize) as *mut (K, V)
|
||||
self.pair_start.add(self.idx) as *mut (K, V)
|
||||
}
|
||||
unsafe fn hash_pair(&self) -> (*mut HashUint, *mut (K, V)) {
|
||||
(self.hash(), self.pair())
|
||||
|
@ -824,7 +824,7 @@ impl<K, V> RawTable<K, V> {
|
|||
unsafe {
|
||||
RawBucket {
|
||||
hash_start: buffer as *mut HashUint,
|
||||
pair_start: buffer.offset(pairs_offset as isize) as *const (K, V),
|
||||
pair_start: buffer.add(pairs_offset) as *const (K, V),
|
||||
idx: index,
|
||||
_marker: marker::PhantomData,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue