multi_buffer: Reduce RefCell::borrow_mut calls to the bare minimum (#40522)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-10-17 18:17:34 +00:00
committed by GitHub
parent 1fbe1e3512
commit 27dcdb5841
9 changed files with 283 additions and 295 deletions
+6 -6
View File
@@ -45,19 +45,19 @@ impl Anchor {
.then_with(|| self.bias.cmp(&other.bias))
}
pub fn min(&self, other: &Self, buffer: &BufferSnapshot) -> Self {
pub fn min<'a>(&'a self, other: &'a Self, buffer: &BufferSnapshot) -> &'a Self {
if self.cmp(other, buffer).is_le() {
*self
self
} else {
*other
other
}
}
pub fn max(&self, other: &Self, buffer: &BufferSnapshot) -> Self {
pub fn max<'a>(&'a self, other: &'a Self, buffer: &BufferSnapshot) -> &'a Self {
if self.cmp(other, buffer).is_ge() {
*self
self
} else {
*other
other
}
}