editor: Shrink size of Inlay slightly (#39089)

And some other smaller cleanup things I noticed while reading through
some stuff

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-09-29 15:33:21 +02:00
committed by GitHub
parent ed7217ff46
commit f2efe78feb
10 changed files with 119 additions and 122 deletions
+10 -13
View File
@@ -62,26 +62,23 @@ impl Anchor {
}
pub fn bias(&self, bias: Bias, buffer: &BufferSnapshot) -> Anchor {
if bias == Bias::Left {
self.bias_left(buffer)
} else {
self.bias_right(buffer)
match bias {
Bias::Left => self.bias_left(buffer),
Bias::Right => self.bias_right(buffer),
}
}
pub fn bias_left(&self, buffer: &BufferSnapshot) -> Anchor {
if self.bias == Bias::Left {
*self
} else {
buffer.anchor_before(self)
match self.bias {
Bias::Left => *self,
Bias::Right => buffer.anchor_before(self),
}
}
pub fn bias_right(&self, buffer: &BufferSnapshot) -> Anchor {
if self.bias == Bias::Right {
*self
} else {
buffer.anchor_after(self)
match self.bias {
Bias::Left => buffer.anchor_after(self),
Bias::Right => *self,
}
}
@@ -96,7 +93,7 @@ impl Anchor {
pub fn is_valid(&self, buffer: &BufferSnapshot) -> bool {
if *self == Anchor::MIN || *self == Anchor::MAX {
true
} else if self.buffer_id != Some(buffer.remote_id) {
} else if self.buffer_id.is_none_or(|id| id != buffer.remote_id) {
false
} else {
let Some(fragment_id) = buffer.try_fragment_id_for_anchor(self) else {