Skip to content

Commit

Permalink
fix: rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Nov 18, 2024
1 parent 618068d commit 8671782
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 2 additions & 9 deletions msim/src/sim/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,7 @@ unsafe fn accept_impl(
let net = plugin::simulator::<NetSim>();
let network = net.network.lock().unwrap();

let endpoint = socket
.endpoint
.as_ref()
.ok_or((-1, libc::EINVAL))?;
let endpoint = socket.endpoint.as_ref().ok_or((-1, libc::EINVAL))?;

if endpoint.peer.is_some() {
// attempt to accept on a socket that is already connected.
Expand Down Expand Up @@ -824,11 +821,7 @@ unsafe fn recv_impl(ep: &Endpoint, msg: *mut libc::msghdr) -> CResult<libc::ssiz
if copy_len < payload.len() {
msg.msg_flags |= libc::MSG_TRUNC;
}
std::ptr::copy_nonoverlapping(
payload.as_ptr(),
iov.iov_base as *mut u8,
copy_len,
);
std::ptr::copy_nonoverlapping(payload.as_ptr(), iov.iov_base as *mut u8, copy_len);

// TODO: create control messages (e.g. original destination addr)
msg.msg_control = std::ptr::null_mut();
Expand Down
4 changes: 1 addition & 3 deletions msim/src/sim/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,7 @@ mod tests {
let std_t0 = std::time::Instant::now();

// Verify that times in other threads are not intercepted.
let std_t1 = std::thread::spawn(std::time::Instant::now)
.join()
.unwrap();
let std_t1 = std::thread::spawn(std::time::Instant::now).join().unwrap();
assert_ne!(std_t0, std_t1);

sleep(Duration::from_secs(1)).await;
Expand Down

0 comments on commit 8671782

Please sign in to comment.