docs: Fix code examples in style guide
Some checks failed
Checks / Prefligit / prefligit (push) Failing after 5s
Checks / Rust / Format (push) Failing after 4s
Checks / Rust / Clippy (push) Failing after 39s
Checks / Rust / Cargo Test (push) Failing after 39s

This commit is contained in:
Jade Ellis 2025-07-02 18:34:55 +01:00
parent be7c334815
commit 823c73f480
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2

View file

@ -181,10 +181,10 @@ debug!(
**Always use closure guards instead of implicitly dropped guards.** This makes lock scopes explicit and helps prevent deadlocks. **Always use closure guards instead of implicitly dropped guards.** This makes lock scopes explicit and helps prevent deadlocks.
Use the `WithLock` trait from `continuwuity-core::utils::with_lock`: Use the `WithLock` trait from `core::utils::with_lock`:
```rs ```rs
use continuwuity_core::utils::with_lock::WithLock; use conduwuit::utils::with_lock::WithLock;
// Good - explicit closure guard // Good - explicit closure guard
shared_data.with_lock(|data| { shared_data.with_lock(|data| {
@ -205,7 +205,7 @@ shared_data.with_lock(|data| {
For async contexts, use the async variant: For async contexts, use the async variant:
```rs ```rs
use continuwuity_core::utils::with_lock::WithLockAsync; use conduwuit::utils::with_lock::WithLockAsync;
// Good - async closure guard // Good - async closure guard
async_shared_data.with_lock(|data| { async_shared_data.with_lock(|data| {