mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-27 09:43:29 +01: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:
parent
95c6621db9
commit
ad7c8c5cdb
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||||
//! }),
|
//! }),
|
||||||
//! );
|
//! );
|
||||||
//!
|
//!
|
||||||
|
|
Loading…
Reference in a new issue