Fix a bunch of other low-hanging style lints (#36498)

- **Fix a bunch of low hanging style lints like unnecessary-return**
- **Fix single worktree violation**
- **And the rest**

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 21:26:17 +02:00 committed by GitHub
parent df9c2aefb1
commit 05fc0c432c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
239 changed files with 854 additions and 1015 deletions

View file

@ -108,7 +108,7 @@ impl Anchor {
fragment_cursor.seek(&Some(fragment_id), Bias::Left);
fragment_cursor
.item()
.map_or(false, |fragment| fragment.visible)
.is_some_and(|fragment| fragment.visible)
}
}
}

View file

@ -57,7 +57,7 @@ where
// Push the old edit if its new end is before the new edit's old start.
if let Some(old_edit) = old_edit.as_ref() {
let new_edit = new_edit.as_ref();
if new_edit.map_or(true, |new_edit| old_edit.new.end < new_edit.old.start) {
if new_edit.is_none_or(|new_edit| old_edit.new.end < new_edit.old.start) {
let catchup = old_edit.old.start - old_start;
old_start += catchup;
new_start += catchup;
@ -78,7 +78,7 @@ where
// Push the new edit if its old end is before the old edit's new start.
if let Some(new_edit) = new_edit.as_ref() {
let old_edit = old_edit.as_ref();
if old_edit.map_or(true, |old_edit| new_edit.old.end < old_edit.new.start) {
if old_edit.is_none_or(|old_edit| new_edit.old.end < old_edit.new.start) {
let catchup = new_edit.new.start - new_start;
old_start += catchup;
new_start += catchup;

View file

@ -1149,7 +1149,7 @@ impl Buffer {
// Insert the new text before any existing fragments within the range.
if !new_text.is_empty() {
let mut old_start = old_fragments.start().1;
if old_fragments.item().map_or(false, |f| f.visible) {
if old_fragments.item().is_some_and(|f| f.visible) {
old_start += fragment_start.0 - old_fragments.start().0.full_offset().0;
}
let new_start = new_fragments.summary().text.visible;
@ -1834,7 +1834,7 @@ impl Buffer {
let mut edits: Vec<(Range<usize>, Arc<str>)> = Vec::new();
let mut last_end = None;
for _ in 0..edit_count {
if last_end.map_or(false, |last_end| last_end >= self.len()) {
if last_end.is_some_and(|last_end| last_end >= self.len()) {
break;
}
let new_start = last_end.map_or(0, |last_end| last_end + 1);
@ -2671,7 +2671,7 @@ impl<D: TextDimension + Ord, F: FnMut(&FragmentSummary) -> bool> Iterator for Ed
if pending_edit
.as_ref()
.map_or(false, |(change, _)| change.new.end < self.new_end)
.is_some_and(|(change, _)| change.new.end < self.new_end)
{
break;
}