Fix clippy needless_borrow in ContextResourceUsage operators

The operator methods take `other: &ContextResourceUsage`, so passing
`&other` to `add_assign`/`sub_assign` (which already take a reference) is a
double-borrow that fails `cargo clippy -- -D warnings`. Drop the `&`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFbRtswu7rsHrttJFauUUb
This commit is contained in:
Erik Johnston
2026-07-16 13:48:05 +00:00
co-authored by Claude Opus 4.8
parent 4681dae117
commit 960acfce19
+4 -4
View File
@@ -219,25 +219,25 @@ impl ContextResourceUsage {
/// `self += other`; mutate in place. pyo3 returns `self` for the in-place slot.
fn __iadd__(&mut self, other: &ContextResourceUsage) {
self.add_assign(&other);
self.add_assign(other);
}
/// `self -= other`; mutate in place. pyo3 returns `self` for the in-place slot.
fn __isub__(&mut self, other: &ContextResourceUsage) {
self.sub_assign(&other);
self.sub_assign(other);
}
/// `self + other`, returning a new object.
fn __add__(&self, other: &ContextResourceUsage) -> ContextResourceUsage {
let mut res = self.clone();
res.add_assign(&other);
res.add_assign(other);
res
}
/// `self - other`, returning a new object.
fn __sub__(&self, other: &ContextResourceUsage) -> ContextResourceUsage {
let mut res = self.clone();
res.sub_assign(&other);
res.sub_assign(other);
res
}
}