Skip to content

Commit 36de3df

Browse files
authored
Apply rustfmt (#198)
1 parent 9cbdfa7 commit 36de3df

File tree

5 files changed

+27
-42
lines changed

5 files changed

+27
-42
lines changed

.github/workflows/rust.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ jobs:
2424
- name: Cargo Test
2525
run: cargo test --verbose --features "${{ matrix.features }}"
2626

27+
fmt:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: dtolnay/rust-toolchain@stable
32+
with:
33+
components: rustfmt
34+
- run: cargo fmt --check
35+
2736
clippy:
2837
name: Run Clippy
2938
runs-on: ${{ matrix.os }}

src/net/tcp/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,4 +430,4 @@ impl Drop for WriteHalf {
430430
world.current_host_mut().tcp.close_stream_half(*self.pair);
431431
})
432432
}
433-
}
433+
}

src/net/udp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,13 @@ impl UdpSocket {
308308
Ok(())
309309
}
310310

311-
/// Has no effect in turmoil. API parity with
311+
/// Has no effect in turmoil. API parity with
312312
/// https://docs.rs/tokio/latest/tokio/net/struct.UdpSocket.html#method.set_multicast_loop_v6
313313
pub fn set_multicast_loop_v6(&self, _on: bool) -> Result<()> {
314314
Ok(())
315315
}
316316

317-
/// Has no effect in turmoil. API parity with
317+
/// Has no effect in turmoil. API parity with
318318
/// https://docs.rs/tokio/latest/tokio/net/struct.UdpSocket.html#method.join_multicast_v6
319319
pub fn join_multicast_v6(&self, _multiaddr: &Ipv6Addr, _interface: u32) -> Result<()> {
320320
Ok(())

src/rt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use futures::Future;
66
use tokio::runtime::Runtime;
77
use tokio::task::JoinHandle;
88
use tokio::task::LocalSet;
9-
use tokio::time::{Duration, Instant, sleep};
9+
use tokio::time::{sleep, Duration, Instant};
1010

1111
use super::Result;
1212

src/sim.rs

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use indexmap::IndexMap;
1010
use tokio::time::Duration;
1111
use tracing::Level;
1212

13-
use crate::{Config, for_pairs, LinksIter, Result, Rt, ToIpAddr, ToIpAddrs, TRACING_TARGET, World};
1413
use crate::host::HostTimer;
14+
use crate::{for_pairs, Config, LinksIter, Result, Rt, ToIpAddr, ToIpAddrs, World, TRACING_TARGET};
1515

1616
/// A handle for interacting with the simulation.
1717
pub struct Sim<'a> {
@@ -430,17 +430,16 @@ impl<'a> Sim<'a> {
430430
#[cfg(test)]
431431
mod test {
432432
use rand::Rng;
433+
use std::future;
433434
use std::{
434435
net::{IpAddr, Ipv4Addr},
435436
rc::Rc,
436437
sync::{
437-
Mutex,
438-
Arc,
439438
atomic::{AtomicU64, Ordering},
439+
Arc, Mutex,
440440
},
441441
time::Duration,
442442
};
443-
use std::future;
444443

445444
use tokio::{
446445
io::{AsyncReadExt, AsyncWriteExt},
@@ -450,9 +449,9 @@ mod test {
450449

451450
use crate::net::UdpSocket;
452451
use crate::{
453-
Builder, elapsed,
454-
hold,
455-
net::{TcpListener, TcpStream}, Result, Sim, sim_elapsed, World,
452+
elapsed, hold,
453+
net::{TcpListener, TcpStream},
454+
sim_elapsed, Builder, Result, Sim, World,
456455
};
457456

458457
#[test]
@@ -686,7 +685,6 @@ mod test {
686685
Ok(())
687686
}
688687

689-
690688
struct Expectation {
691689
expect_a_receive: bool,
692690
expect_b_receive: bool,
@@ -848,41 +846,19 @@ mod test {
848846
Ok(())
849847
}
850848

851-
run_with_actions(&[
852-
Action::PartitionOnewayAB,
853-
])?;
854-
run_with_actions(&[
855-
Action::PartitionOnewayBA,
856-
])?;
849+
run_with_actions(&[Action::PartitionOnewayAB])?;
850+
run_with_actions(&[Action::PartitionOnewayBA])?;
851+
run_with_actions(&[Action::Partition, Action::RepairOnewayAB])?;
852+
run_with_actions(&[Action::Partition, Action::RepairOnewayBA])?;
853+
run_with_actions(&[Action::PartitionOnewayAB, Action::Repair])?;
854+
run_with_actions(&[Action::PartitionOnewayBA, Action::Repair])?;
855+
run_with_actions(&[Action::PartitionOnewayBA, Action::RepairOnewayAB])?;
856+
run_with_actions(&[Action::PartitionOnewayAB, Action::PartitionOnewayBA])?;
857857
run_with_actions(&[
858858
Action::Partition,
859859
Action::RepairOnewayAB,
860-
])?;
861-
run_with_actions(&[
862-
Action::Partition,
863860
Action::RepairOnewayBA,
864861
])?;
865-
run_with_actions(&[
866-
Action::PartitionOnewayAB,
867-
Action::Repair,
868-
])?;
869-
run_with_actions(&[
870-
Action::PartitionOnewayBA,
871-
Action::Repair,
872-
])?;
873-
run_with_actions(&[
874-
Action::PartitionOnewayBA,
875-
Action::RepairOnewayAB,
876-
])?;
877-
run_with_actions(&[
878-
Action::PartitionOnewayAB,
879-
Action::PartitionOnewayBA,
880-
])?;
881-
run_with_actions(&[
882-
Action::Partition,
883-
Action::RepairOnewayAB,
884-
Action::RepairOnewayBA
885-
])?;
886862

887863
Ok(())
888864
}

0 commit comments

Comments
 (0)