Skip to content

Commit 35ee1ba

Browse files
committed
Mark #[must_use] for methods of ThreadPoolBuilder
1 parent 9ee8f8d commit 35ee1ba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spdlog/src/thread_pool.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ impl ThreadPoolBuilder {
127127
/// # Panics
128128
///
129129
/// Panics if the value is zero.
130+
#[must_use]
130131
pub fn capacity(&mut self, capacity: usize) -> &mut Self {
131132
self.capacity = capacity;
132133
self
@@ -137,6 +138,7 @@ impl ThreadPoolBuilder {
137138
//
138139
// If it is ready to be made public in the future, please don't forget to
139140
// replace the `panic!` in the `build` function with a recoverable error.
141+
#[must_use]
140142
#[allow(dead_code)]
141143
fn threads(&mut self, threads: usize) -> &mut Self {
142144
self.threads = threads;
@@ -146,6 +148,7 @@ impl ThreadPoolBuilder {
146148
/// Provide a function that will be called on each thread of the thread pool
147149
/// immediately after it is spawned. This can, for example, be used to set
148150
/// core affinity for each thread.
151+
#[must_use]
149152
pub fn on_thread_spawn<F>(&mut self, f: F) -> &mut Self
150153
where
151154
F: Fn() + Send + Sync + 'static,
@@ -156,6 +159,7 @@ impl ThreadPoolBuilder {
156159

157160
/// Provide a function that will be called on each thread of the thread pool
158161
/// just before the thread finishes.
162+
#[must_use]
159163
pub fn on_thread_finish<F>(&mut self, f: F) -> &mut Self
160164
where
161165
F: Fn() + Send + Sync + 'static,

0 commit comments

Comments
 (0)