Skip to content

Commit 32cd1a9

Browse files
committed
Add comment explaining why unwrap() is acceptable for mutex lock
1 parent ebf2441 commit 32cd1a9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/pet-core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ pub trait Locator: Send + Sync {
8888
/// impl Locator for MyLocator {
8989
/// fn configure(&self, config: &Configuration) {
9090
/// if let Some(dirs) = &config.workspace_directories {
91+
/// // Using unwrap() is acceptable here as mutex poisoning indicates
92+
/// // a panic in another thread, which is unrecoverable in this context.
9193
/// *self.workspace_dirs.lock().unwrap() = dirs.clone();
9294
/// }
9395
/// }

0 commit comments

Comments
 (0)