fix clippy

Signed-off-by: Yuchen Liang <yuchen@neon.tech>
This commit is contained in:
Yuchen Liang
2024-10-09 09:39:24 -04:00
parent b418c343e1
commit 62722e8559
4 changed files with 4 additions and 5 deletions

View File

@@ -651,9 +651,9 @@ impl PageCache {
size_metrics.current_bytes_immutable.set_page_sz(0);
let slots = page_buffer
// Each chunk has `PAGE_SZ` (8192) bytes, greater than 512, still aligned.
.chunks_exact_mut(PAGE_SZ)
.map(|chunk| {
// SAFETY: Each chunk has `PAGE_SZ` (8192) bytes, greater than 512, still aligned.
let buf = unsafe { IoPageSlice::new_unchecked(chunk.try_into().unwrap()) };
Slot {

View File

@@ -1366,7 +1366,6 @@ pub(crate) type IoBufferMut = aligned_buffer::AlignedBufferMut<{ get_io_buffer_a
pub(crate) type IoPageSlice<'a> =
aligned_buffer::AlignedSlice<'a, { get_io_buffer_alignment() }, PAGE_SZ>;
static IO_MODE: AtomicU8 = AtomicU8::new(IoMode::preferred() as u8);
pub(crate) fn set_io_mode(mode: IoMode) {
@@ -1715,7 +1714,7 @@ mod tests {
.await
.unwrap()
.into_inner();
assert!(&buf[..] == SAMPLE);
assert!(buf[..] == SAMPLE);
}
});
hdls.push(hdl);

View File

@@ -49,7 +49,7 @@ impl<'a, const ALIGN: usize, const N: usize> DerefMut for AlignedSlice<'a, ALIGN
impl<'a, const ALIGN: usize, const N: usize> AsRef<[u8; N]> for AlignedSlice<'a, ALIGN, N> {
fn as_ref(&self) -> &[u8; N] {
&self.0
self.0
}
}

View File

@@ -8,4 +8,4 @@ pub trait IoBufAlignedMut: IoBufMut {}
impl IoBufAlignedMut for IoBufferMut {}
impl<'a> IoBufAlignedMut for PageWriteGuardBuf {}
impl IoBufAlignedMut for PageWriteGuardBuf {}