Enable clippy::never_loop (#9006)

Three changes: two of which are changing `while let` construct to `if
let` as they unconditionally broke and one of which was removing a loop
in the `start_default_prettier` as it unconditionally broke in the
control flow for match installation task: the diff for this is larger
than needed as removing the loop changed a lot of indentation for
`rustfmt`.
This commit is contained in:
Kirpal Grewal 2024-03-14 18:07:50 +00:00 committed by GitHub
parent df27e783ae
commit 61225ecef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 49 additions and 53 deletions

View File

@ -412,7 +412,6 @@ derive_ord_xor_partial_ord = "allow"
eq_op = "allow"
let_underscore_future = "allow"
map_entry = "allow"
never_loop = "allow"
non_canonical_clone_impl = "allow"
non_canonical_partial_ord_impl = "allow"
reversed_empty_ranges = "allow"

View File

@ -2094,7 +2094,7 @@ impl Conversation {
let buffer = self.buffer.read(cx);
let mut message_anchors = self.message_anchors.iter().enumerate().peekable();
iter::from_fn(move || {
while let Some((start_ix, message_anchor)) = message_anchors.next() {
if let Some((start_ix, message_anchor)) = message_anchors.next() {
let metadata = self.messages_metadata.get(&message_anchor.id)?;
let message_start = message_anchor.start.to_offset(buffer);
let mut message_end = None;

View File

@ -1349,7 +1349,7 @@ impl MultiBuffer {
cursor.next(&());
// Skip over any subsequent excerpts that are also removed.
while let Some(&next_excerpt_id) = excerpt_ids.peek() {
if let Some(&next_excerpt_id) = excerpt_ids.peek() {
let next_locator = snapshot.excerpt_locator_for_id(next_excerpt_id);
if let Some(next_excerpt) = cursor.item() {
if next_excerpt.locator == *next_locator {
@ -1358,7 +1358,6 @@ impl MultiBuffer {
continue 'remove_excerpts;
}
}
break;
}
break;

View File

@ -230,7 +230,6 @@ fn start_default_prettier(
cx: &mut ModelContext<'_, Project>,
) -> Task<anyhow::Result<PrettierTask>> {
cx.spawn(|project, mut cx| async move {
loop {
let installation_task = project.update(&mut cx, |project, _| {
match &project.default_prettier.prettier {
PrettierInstallation::NotInstalled {
@ -292,7 +291,6 @@ fn start_default_prettier(
}
},
}
}
})
}