Remove if-not-else patterns (#10402)

This commit is contained in:
Joseph T. Lyons 2024-04-11 03:48:06 -04:00 committed by GitHub
parent 36a87d0f5c
commit eb6f7c1240
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 99 additions and 99 deletions

View file

@ -1999,10 +1999,10 @@ impl Snapshot {
let mut repositories = self.repositories().peekable();
entries.map(move |entry| {
while let Some((repo_path, _)) = containing_repos.last() {
if !entry.path.starts_with(repo_path) {
containing_repos.pop();
} else {
if entry.path.starts_with(repo_path) {
break;
} else {
containing_repos.pop();
}
}
while let Some((repo_path, _)) = repositories.peek() {
@ -2033,10 +2033,10 @@ impl Snapshot {
let entry_to_finish = match (containing_entry, next_entry) {
(Some(_), None) => entry_stack.pop(),
(Some(containing_entry), Some(next_path)) => {
if !next_path.path.starts_with(&containing_entry.path) {
entry_stack.pop()
} else {
if next_path.path.starts_with(&containing_entry.path) {
None
} else {
entry_stack.pop()
}
}
(None, Some(_)) => None,
@ -3930,7 +3930,9 @@ impl BackgroundScanner {
child_entry.is_ignored = ignore_stack.is_abs_path_ignored(&child_abs_path, true);
// Avoid recursing until crash in the case of a recursive symlink
if !job.ancestor_inodes.contains(&child_entry.inode) {
if job.ancestor_inodes.contains(&child_entry.inode) {
new_jobs.push(None);
} else {
let mut ancestor_inodes = job.ancestor_inodes.clone();
ancestor_inodes.insert(child_entry.inode);
@ -3947,8 +3949,6 @@ impl BackgroundScanner {
scan_queue: job.scan_queue.clone(),
containing_repository: job.containing_repository.clone(),
}));
} else {
new_jobs.push(None);
}
} else {
child_entry.is_ignored = ignore_stack.is_abs_path_ignored(&child_abs_path, false);
@ -4686,10 +4686,10 @@ impl<'a, 'b> SeekTarget<'a, EntrySummary, TraversalProgress<'a>> for TraversalTa
match self {
TraversalTarget::Path(path) => path.cmp(&cursor_location.max_path),
TraversalTarget::PathSuccessor(path) => {
if !cursor_location.max_path.starts_with(path) {
Ordering::Equal
} else {
if cursor_location.max_path.starts_with(path) {
Ordering::Greater
} else {
Ordering::Equal
}
}
TraversalTarget::Count {
@ -4799,10 +4799,10 @@ fn combine_git_statuses(
) -> Option<GitFileStatus> {
if let Some(staged) = staged {
if let Some(unstaged) = unstaged {
if unstaged != staged {
Some(GitFileStatus::Modified)
} else {
if unstaged == staged {
Some(staged)
} else {
Some(GitFileStatus::Modified)
}
} else {
Some(staged)