From 02608e13ab818dc95616f7ab244f202aeb9a7b84 Mon Sep 17 00:00:00 2001 From: Zack Date: Thu, 16 Dec 2021 19:14:27 +0800 Subject: [PATCH] docs: Update code PR advice document Allow using `expect()` for `Mutex.lock()` because it is almost unrecoverable if failed in the lock acquisition Fixes: #3285 Signed-off-by: Zack --- docs/code-pr-advice.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/code-pr-advice.md b/docs/code-pr-advice.md index ac0ea76afb..1b5aac0687 100644 --- a/docs/code-pr-advice.md +++ b/docs/code-pr-advice.md @@ -198,6 +198,7 @@ The table below lists the small number of cases where use of | `defer!()` | Similar to golang's `defer()` but doesn't allow the use of `?`. | | `tokio::spawn(async move {})` | Cannot currently return a `Result` from an `async move` closure. | | If an explicit test is performed before the `unwrap()` / `expect()` | *"Just about acceptable"*, but not ideal `[*]` | +| `Mutex.lock()` | Almost unrecoverable if failed in the lock acquisition | `[*]` - There can lead to bad *future* code: consider what would