Skip to content

Commit

Permalink
update ci & fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
my-vegetable-has-exploded authored and GTwhy committed Nov 21, 2023
1 parent 0f2d0f6 commit 9480131
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
schedule: [cron: "0 */24 * * *"]

env:
CI_RUST_TOOLCHAIN: 1.61.0
CI_RUST_TOOLCHAIN: 1.63.0

jobs:
soft-roce-env:
Expand Down
2 changes: 1 addition & 1 deletion examples/cm_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async fn run(node: &str, service: &str) {
.alloc_local_mr(Layout::new::<[u8; BUF_SIZE]>())
.unwrap();
let _ = lmr.as_mut_slice().write(&[BUF_FILLER; BUF_SIZE]).unwrap();
let _ = rdma.send_raw(&lmr).await.unwrap();
rdma.send_raw(&lmr).await.unwrap();
println!("send {:?}", *lmr.as_slice());

// recv raw data from server
Expand Down
8 changes: 2 additions & 6 deletions src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,21 +337,17 @@ impl AgentThread {

/// The main agent function that handles messages sent from the other side
async fn main(self: Arc<Self>) -> io::Result<()> {
// SAFETY: ?
// TODO: check safety
let mut header_buf = self
.inner
.allocator
// alignment 1 is always correct
// SAFETY: alignment 1 is always correct
.alloc_zeroed_default(unsafe {
&Layout::from_size_align_unchecked(*REQUEST_HEADER_MAX_LEN, 1)
})?;
// SAFETY: ?
// TODO: check safety
let mut data_buf = self
.inner
.allocator
// alignment 1 is always correct
// SAFETY: alignment 1 is always correct
.alloc_zeroed_default(unsafe {
&Layout::from_size_align_unchecked(self.max_sr_data_len, 1)
})?;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
warnings, // treat all wanings as errors
clippy::all,
clippy::restriction,
// clippy::restriction,
clippy::pedantic,
// clippy::nursery, // It's still under development
clippy::cargo,
Expand Down
8 changes: 4 additions & 4 deletions src/memory_region/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub unsafe trait LocalMrReadAccess: MrAccess {
#[inline]
#[allow(clippy::as_conversions)]
fn as_ptr_unchecked(&self) -> *const u8 {
self.addr() as _
self.addr() as *const u8
}

/// Get the memory region as slice until it is readable
Expand Down Expand Up @@ -274,7 +274,7 @@ pub unsafe trait LocalMrWriteAccess: MrAccess + LocalMrReadAccess {
#[allow(clippy::as_conversions)]
fn as_mut_ptr_unchecked(&mut self) -> *mut u8 {
// const pointer to mut pointer is safe
self.as_ptr_unchecked() as _
self.as_ptr_unchecked() as *mut u8
}

/// Get the memory region as mutable slice until it is writeable
Expand Down Expand Up @@ -556,13 +556,13 @@ impl Drop for LocalMrInner {
match self.strategy {
crate::MRManageStrategy::Jemalloc => {
// SAFETY: ffi
unsafe { tikv_jemalloc_sys::free(self.addr as _) }
unsafe { tikv_jemalloc_sys::free(self.addr as *mut libc::c_void) }
}
crate::MRManageStrategy::Raw => {
// SAFETY: The ptr is allocated via this allocator, and the layout is the same layout
// that was used to allocate that block of memory.
unsafe {
dealloc(self.addr as _, self.layout);
dealloc(self.addr as *mut u8, self.layout);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mr_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ fn remove_item(addr: *mut c_void) {
#[allow(clippy::as_conversions)]
#[allow(clippy::unreachable)]
fn remove_item_after_lock(map: &mut MutexGuard<BTreeMap<usize, Item>>, addr: *mut c_void) {
map.remove(&(addr as _)).map_or_else(
map.remove(&(addr as usize)).map_or_else(
|| {
unreachable!(
"can not get item from EXTENT_TOKEN_MAP. addr : {}",
Expand Down
2 changes: 1 addition & 1 deletion src/work_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl AsRef<ibv_send_wr> for SendWr {
}
}

impl<'lm> AsMut<ibv_send_wr> for SendWr {
impl AsMut<ibv_send_wr> for SendWr {
fn as_mut(&mut self) -> &mut ibv_send_wr {
&mut self.inner
}
Expand Down

0 comments on commit 9480131

Please sign in to comment.