From ad7c8c5cdb6948a18477fb4a7f719cb29eccdf96 Mon Sep 17 00:00:00 2001 From: Mark Tuddenham Date: Tue, 9 Aug 2022 15:23:16 +0100 Subject: [PATCH] docs: use local variable in closure (#1232) The "Using closure captures for shared state" example creates two clones when only one is needed. --- axum/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/axum/src/lib.rs b/axum/src/lib.rs index be095caa..b355d6dc 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -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) //! }), //! ); //!