Skip to content

Commit

Permalink
Use separate lexical scope for lock guard in docs (#2439)
Browse files Browse the repository at this point in the history
  • Loading branch information
takkuumi authored Dec 19, 2023
1 parent 212d959 commit 3fda093
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions axum/src/extract/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
/// }
///
/// // ...
/// }
Expand Down

0 comments on commit 3fda093

Please sign in to comment.