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

This commit is contained in:
Fujiwara Takumi
2023-12-19 16:21:24 +00:00
committed by GitHub
parent 212d959a54
commit 3fda093806
+4 -2
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();
/// }
///
/// // ...
/// }