Skip to content

Commit a6b3904

Browse files
committed
Fix formatting
1 parent e3a1fcc commit a6b3904

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

src/pipe.rs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,14 @@ impl<M: RawMutex, T, const N: usize> ConnectedPipe<M, T, N> {
161161
}
162162
}
163163

164-
165164
#[cfg(test)]
166165
mod tests {
167166
use core::time::Duration;
168167

169168
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
170169
use futures_executor::{LocalPool, ThreadPool};
171-
use futures_util::{future::select, pin_mut, task::SpawnExt, FutureExt};
172170
use futures_timer::Delay;
171+
use futures_util::{future::select, pin_mut, task::SpawnExt, FutureExt};
173172

174173
use super::ConnectedPipe;
175174

@@ -185,57 +184,56 @@ mod tests {
185184

186185
static PIPE: ConnectedPipe<CriticalSectionRawMutex, usize, 5> = ConnectedPipe::new();
187186

188-
// Task that sends
189-
spawner.spawn(async {
190-
wait_milis(10).await;
191-
192-
PIPE.push(23).await;
193-
PIPE.push(56).await;
194-
PIPE.push(67).await;
195-
}).unwrap();
187+
// Task that sends
188+
spawner
189+
.spawn(async {
190+
wait_milis(10).await;
196191

192+
PIPE.push(23).await;
193+
PIPE.push(56).await;
194+
PIPE.push(67).await;
195+
})
196+
.unwrap();
197197

198198
// Task that receives
199-
spawner.spawn(async {
200-
let reader = PIPE.reader();
201-
let value = reader.receive().await;
202-
assert_eq!(value, 23);
203-
let value = reader.receive().await;
204-
assert_eq!(value, 56);
205-
let value = reader.receive().await;
206-
assert_eq!(value, 67);
207-
208-
}).unwrap();
199+
spawner
200+
.spawn(async {
201+
let reader = PIPE.reader();
202+
let value = reader.receive().await;
203+
assert_eq!(value, 23);
204+
let value = reader.receive().await;
205+
assert_eq!(value, 56);
206+
let value = reader.receive().await;
207+
assert_eq!(value, 67);
208+
})
209+
.unwrap();
209210

210211
executor.run();
211212
}
212213

213214
#[futures_test::test]
214215
async fn test_send_drop() {
215-
216216
static PIPE: ConnectedPipe<CriticalSectionRawMutex, usize, 5> = ConnectedPipe::new();
217217

218218
PIPE.push(23).await;
219219
PIPE.push(56).await;
220220
PIPE.push(67).await;
221221

222-
223222
// Create a reader after sending
224223
let reader = PIPE.reader();
225-
let receive = reader.receive()
226-
.fuse();
224+
let receive = reader.receive().fuse();
227225
pin_mut!(receive);
228226

229227
let timeout = wait_milis(50).fuse();
230228
pin_mut!(timeout);
231229

232230
let either = select(receive, timeout).await;
233-
231+
234232
match either {
235233
futures_util::future::Either::Left(_) => {
236234
panic!("There should be nothing to receive!");
237-
},
238-
futures_util::future::Either::Right(_) => {},
235+
}
236+
futures_util::future::Either::Right(_) => {}
239237
}
240238
}
241239

@@ -245,23 +243,25 @@ mod tests {
245243

246244
let executor = ThreadPool::new().unwrap();
247245

248-
executor.spawn(async {
249-
for i in 0..1000 {
250-
PIPE.push(i).await;
251-
}
252-
}).unwrap();
246+
executor
247+
.spawn(async {
248+
for i in 0..1000 {
249+
PIPE.push(i).await;
250+
}
251+
})
252+
.unwrap();
253253

254-
executor.spawn(async {
255-
for i in 1000..2000 {
256-
PIPE.push(i).await;
257-
}
258-
}).unwrap();
254+
executor
255+
.spawn(async {
256+
for i in 1000..2000 {
257+
PIPE.push(i).await;
258+
}
259+
})
260+
.unwrap();
259261

260262
let reader = PIPE.reader();
261263
for _ in 0..800 {
262264
reader.receive().await;
263265
}
264-
265266
}
266-
267267
}

0 commit comments

Comments
 (0)