Merge pull request #3286 from zmlcc/pr-advice-expect-211216

docs: Update code PR advice document
This commit is contained in:
Jakob Naucke 2021-12-17 15:35:05 +01:00 committed by GitHub
commit 7fdb425918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 `?`. | | `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. | | `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 `[*]` | | 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 `[*]` - There can lead to bad *future* code: consider what would