Skip to content

Commit 89d0fb5

Browse files
committed
chore: fmt
Signed-off-by: John Nunley <[email protected]>
1 parent f77c5dd commit 89d0fb5

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

benches/executor.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ fn running_benches(c: &mut Criterion) {
5858
let mut handles = vec![];
5959

6060
b.iter(|| {
61-
EX.spawn_many(
62-
(0..250).map(|_| future::yield_now()),
63-
&mut handles
64-
);
61+
EX.spawn_many((0..250).map(|_| future::yield_now()), &mut handles);
6562
});
6663

6764
handles.clear();

src/lib.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,49 +171,49 @@ impl<'a> Executor<'a> {
171171
}
172172

173173
/// Spawns many tasks onto the executor.
174-
///
174+
///
175175
/// As opposed to the [`spawn`] method, this locks the executor's inner task lock once and
176176
/// spawns all of the tasks in one go. With large amounts of tasks this can improve
177177
/// contention.
178-
///
178+
///
179179
/// For very large numbers of tasks the lock is occasionally dropped and re-acquired to
180180
/// prevent runner thread starvation. It is assumed that the iterator provided does not
181181
/// block; blocking iterators can lock up the internal mutex and therefore the entire
182182
/// executor.
183-
///
183+
///
184184
/// ## Example
185-
///
185+
///
186186
/// ```
187187
/// use async_executor::Executor;
188188
/// use futures_lite::{stream, prelude::*};
189189
/// use std::future::ready;
190-
///
190+
///
191191
/// # futures_lite::future::block_on(async {
192192
/// let mut ex = Executor::new();
193-
///
193+
///
194194
/// let futures = [
195195
/// ready(1),
196196
/// ready(2),
197197
/// ready(3)
198198
/// ];
199-
///
199+
///
200200
/// // Spawn all of the futures onto the executor at once.
201201
/// let mut tasks = vec![];
202202
/// ex.spawn_many(futures, &mut tasks);
203-
///
203+
///
204204
/// // Await all of them.
205205
/// let results = ex.run(async move {
206206
/// stream::iter(tasks).then(|x| x).collect::<Vec<_>>().await
207207
/// }).await;
208208
/// assert_eq!(results, [1, 2, 3]);
209209
/// # });
210210
/// ```
211-
///
211+
///
212212
/// [`spawn`]: Executor::spawn
213213
pub fn spawn_many<T: Send + 'a, F: Future<Output = T> + Send + 'a>(
214214
&self,
215215
futures: impl IntoIterator<Item = F>,
216-
handles: &mut impl Extend<Task<F::Output>>
216+
handles: &mut impl Extend<Task<F::Output>>,
217217
) {
218218
let mut active = self.state().active.lock().unwrap();
219219

@@ -494,49 +494,49 @@ impl<'a> LocalExecutor<'a> {
494494
}
495495

496496
/// Spawns many tasks onto the executor.
497-
///
497+
///
498498
/// As opposed to the [`spawn`] method, this locks the executor's inner task lock once and
499499
/// spawns all of the tasks in one go. With large amounts of tasks this can improve
500500
/// contention.
501-
///
501+
///
502502
/// It is assumed that the iterator provided does not block; blocking iterators can lock up
503503
/// the internal mutex and therefore the entire executor. Unlike [`Executor::spawn`], the
504504
/// mutex is not released, as there are no other threads that can poll this executor.
505-
///
505+
///
506506
/// ## Example
507-
///
507+
///
508508
/// ```
509509
/// use async_executor::LocalExecutor;
510510
/// use futures_lite::{stream, prelude::*};
511511
/// use std::future::ready;
512-
///
512+
///
513513
/// # futures_lite::future::block_on(async {
514514
/// let mut ex = LocalExecutor::new();
515-
///
515+
///
516516
/// let futures = [
517517
/// ready(1),
518518
/// ready(2),
519519
/// ready(3)
520520
/// ];
521-
///
521+
///
522522
/// // Spawn all of the futures onto the executor at once.
523523
/// let mut tasks = vec![];
524524
/// ex.spawn_many(futures, &mut tasks);
525-
///
525+
///
526526
/// // Await all of them.
527527
/// let results = ex.run(async move {
528528
/// stream::iter(tasks).then(|x| x).collect::<Vec<_>>().await
529529
/// }).await;
530530
/// assert_eq!(results, [1, 2, 3]);
531531
/// # });
532532
/// ```
533-
///
533+
///
534534
/// [`spawn`]: LocalExecutor::spawn
535535
/// [`Executor::spawn_many`]: Executor::spawn_many
536536
pub fn spawn_many<T: Send + 'a, F: Future<Output = T> + Send + 'a>(
537537
&self,
538538
futures: impl IntoIterator<Item = F>,
539-
handles: &mut impl Extend<Task<F::Output>>
539+
handles: &mut impl Extend<Task<F::Output>>,
540540
) {
541541
let mut active = self.inner().state().active.lock().unwrap();
542542

@@ -1089,7 +1089,7 @@ fn debug_executor(executor: &Executor<'_>, name: &str, f: &mut fmt::Formatter<'_
10891089
}
10901090

10911091
/// Container with one item.
1092-
///
1092+
///
10931093
/// This implements `Extend` for one-off cases.
10941094
struct Container<T>(Option<T>);
10951095

0 commit comments

Comments
 (0)