Use separate lexical scope for lock guard in docs (#2439)

This commit is contained in:
Fujiwara Takumi 2023-12-20 00:21:24 +08:00 committed by GitHub
parent 212d959a54
commit 3fda093806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -321,8 +321,10 @@ use std::{
/// }
///
/// async fn handler(State(state): State<AppState>) {
/// let mut data = state.data.lock().expect("mutex was poisoned");
/// *data = "updated foo".to_owned();
/// {
/// let mut data = state.data.lock().expect("mutex was poisoned");
/// *data = "updated foo".to_owned();
/// }
///
/// // ...
/// }