chore: un-allow clippy's "readonly_write_lock" (#5862)

This commit is contained in:
LFC
2025-04-10 10:05:50 +08:00
committed by GitHub
parent 4b82ec7409
commit e23979df9f
2 changed files with 6 additions and 1 deletions

View File

@@ -77,7 +77,6 @@ clippy.print_stdout = "warn"
clippy.print_stderr = "warn"
clippy.dbg_macro = "warn"
clippy.implicit_clone = "warn"
clippy.readonly_write_lock = "allow"
rust.unknown_lints = "deny"
rust.unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }

View File

@@ -114,7 +114,13 @@ impl TxnService for RaftEngineBackend {
} = txn.into();
let mut succeeded = true;
// Here we are using the write lock to guard against parallel access inside "txn", and
// outside "get" or "put" etc. It doesn't serve the purpose of mutating some Rust data, so
// the variable is not "mut". Suppress the clippy warning because of this.
#[allow(clippy::readonly_write_lock)]
let engine = self.engine.write().unwrap();
for cmp in compare {
let existing_value = engine_get(&engine, &cmp.key)?.map(|kv| kv.value);
if !cmp.compare_value(existing_value.as_ref()) {