mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +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",
|
//! "/users",
|
||||||
//! post({
|
//! post({
|
||||||
//! let shared_state = Arc::clone(&shared_state);
|
//! let shared_state = Arc::clone(&shared_state);
|
||||||
//! move |body| create_user(body, Arc::clone(&shared_state))
|
//! move |body| create_user(body, shared_state)
|
||||||
//! }),
|
//! }),
|
||||||
//! )
|
//! )
|
||||||
//! .route(
|
//! .route(
|
||||||
//! "/users/:id",
|
//! "/users/:id",
|
||||||
//! get({
|
//! get({
|
||||||
//! let shared_state = Arc::clone(&shared_state);
|
//! 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