mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-19 00:00:14 +02:00
docs: use local variable in closure (#1232)
The "Using closure captures for shared state" example creates two clones when only one is needed.
This commit is contained in:
+2
-2
@@ -234,14 +234,14 @@
|
||||
//! "/users",
|
||||
//! post({
|
||||
//! let shared_state = Arc::clone(&shared_state);
|
||||
//! move |body| create_user(body, Arc::clone(&shared_state))
|
||||
//! move |body| create_user(body, shared_state)
|
||||
//! }),
|
||||
//! )
|
||||
//! .route(
|
||||
//! "/users/:id",
|
||||
//! get({
|
||||
//! let shared_state = Arc::clone(&shared_state);
|
||||
//! move |path| get_user(path, Arc::clone(&shared_state))
|
||||
//! move |path| get_user(path, shared_state)
|
||||
//! }),
|
||||
//! );
|
||||
//!
|
||||
|
||||
Reference in New Issue
Block a user