From d810fbe9fd50ff68a1087e3dea7ab49f8e2643fd Mon Sep 17 00:00:00 2001 From: wspsxing Date: Tue, 3 Mar 2020 10:54:49 +0800 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Eliza Weisman --- tokio/src/runtime/builder.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 2622a61da24..e3fafa59dfb 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -177,7 +177,7 @@ impl Builder { self } - /// Set the name fn of threads spawned by the `Runtime`'s thread pool. + /// Sets a function used to generate the name of threads spawned by the `Runtime`'s thread pool. /// /// The default name fn is `|| "tokio-runtime-worker".into()`. /// @@ -189,12 +189,12 @@ impl Builder { /// /// # pub fn main() { /// let rt = runtime::Builder::new() - /// .thread_name_fn(|| { - /// static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0); - /// let id = ATOMIC_ID.fetch_add(1, Ordering::SeqCst); - /// format!("my-pool-{}", id) - /// }) - /// .build(); + /// .thread_name_fn(|| { + /// static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0); + /// let id = ATOMIC_ID.fetch_add(1, Ordering::SeqCst); + /// format!("my-pool-{}", id) + /// }) + /// .build(); /// # } /// ``` pub fn thread_name_fn(&mut self, f: F) -> &mut Self @@ -482,7 +482,7 @@ impl fmt::Debug for Builder { fmt.debug_struct("Builder") .field("kind", &self.kind) .field("num_threads", &self.num_threads) - .field("thread_name_fn", &"String+Send+Sync+'static>") + .field("thread_name_fn", &" String + Send + Sync + 'static>") .field("thread_stack_size", &self.thread_stack_size) .field("after_start", &self.after_start.as_ref().map(|_| "...")) .field("before_stop", &self.after_start.as_ref().map(|_| "..."))