Unverified Commit 4bc9ecee authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

chore(turbo-tasks-backend): Remove collapsible-if lints (#71758)

I can believe that the non-collapsed if might be slightly more readable, but once you have to silence the lint with `#[allow(clippy::collapsible_if, reason = "readablility")]`, it's no longer worth it.

Closes PACK-3326
parent 1344b75e
...@@ -590,19 +590,16 @@ impl AggregationUpdateQueue { ...@@ -590,19 +590,16 @@ impl AggregationUpdateQueue {
} }
self.inner_of_uppers_has_new_follower(ctx, new_follower_id, upper_ids); self.inner_of_uppers_has_new_follower(ctx, new_follower_id, upper_ids);
} }
} else { } else if let Some(upper_id) = upper_ids.pop() {
#[allow(clippy::collapsible_if, reason = "readablility")] if !upper_ids.is_empty() {
if let Some(upper_id) = upper_ids.pop() { self.jobs.push_front(AggregationUpdateJobItem::new(
if !upper_ids.is_empty() { AggregationUpdateJob::InnerOfUppersHasNewFollowers {
self.jobs.push_front(AggregationUpdateJobItem::new( upper_ids,
AggregationUpdateJob::InnerOfUppersHasNewFollowers { new_follower_ids: new_follower_ids.clone(),
upper_ids, },
new_follower_ids: new_follower_ids.clone(), ));
},
));
}
self.inner_of_upper_has_new_followers(ctx, new_follower_ids, upper_id);
} }
self.inner_of_upper_has_new_followers(ctx, new_follower_ids, upper_id);
} }
} }
AggregationUpdateJob::InnerOfUppersHasNewFollower { AggregationUpdateJob::InnerOfUppersHasNewFollower {
...@@ -647,19 +644,16 @@ impl AggregationUpdateQueue { ...@@ -647,19 +644,16 @@ impl AggregationUpdateQueue {
} }
self.inner_of_uppers_lost_follower(ctx, lost_follower_id, upper_ids); self.inner_of_uppers_lost_follower(ctx, lost_follower_id, upper_ids);
} }
} else { } else if let Some(upper_id) = upper_ids.pop() {
#[allow(clippy::collapsible_if, reason = "readablility")] if !upper_ids.is_empty() {
if let Some(upper_id) = upper_ids.pop() { self.jobs.push_front(AggregationUpdateJobItem::new(
if !upper_ids.is_empty() { AggregationUpdateJob::InnerOfUppersLostFollowers {
self.jobs.push_front(AggregationUpdateJobItem::new( upper_ids,
AggregationUpdateJob::InnerOfUppersLostFollowers { lost_follower_ids: lost_follower_ids.clone(),
upper_ids, },
lost_follower_ids: lost_follower_ids.clone(), ));
},
));
}
self.inner_of_upper_lost_followers(ctx, lost_follower_ids, upper_id);
} }
self.inner_of_upper_lost_followers(ctx, lost_follower_ids, upper_id);
} }
} }
AggregationUpdateJob::InnerOfUppersLostFollower { AggregationUpdateJob::InnerOfUppersLostFollower {
...@@ -799,13 +793,11 @@ impl AggregationUpdateQueue { ...@@ -799,13 +793,11 @@ impl AggregationUpdateQueue {
// Add the same amount of upper edges // Add the same amount of upper edges
if update_count!(task, Upper { task: upper_id }, count) { if update_count!(task, Upper { task: upper_id }, count) {
if !upper_id.is_transient() { if !upper_id.is_transient()
#[allow(clippy::collapsible_if, reason = "readablility")] && update_ucount_and_get!(task, PersistentUpperCount, 1)
if update_ucount_and_get!(task, PersistentUpperCount, 1)
.is_power_of_two() .is_power_of_two()
{ {
self.push_optimize_task(task_id); self.push_optimize_task(task_id);
}
} }
// When this is a new inner node, update aggregated data and // When this is a new inner node, update aggregated data and
// followers // followers
...@@ -1287,11 +1279,10 @@ impl AggregationUpdateQueue { ...@@ -1287,11 +1279,10 @@ impl AggregationUpdateQueue {
for &(follower_id, _) in followers_with_aggregation_number.iter() { for &(follower_id, _) in followers_with_aggregation_number.iter() {
let mut follower = ctx.task(follower_id, TaskDataCategory::Meta); let mut follower = ctx.task(follower_id, TaskDataCategory::Meta);
if update_count!(follower, Upper { task: upper_id }, 1) { if update_count!(follower, Upper { task: upper_id }, 1) {
if !upper_id.is_transient() { if !upper_id.is_transient()
#[allow(clippy::collapsible_if, reason = "readablility")] && update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two()
if update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two() { {
self.push_optimize_task(follower_id); self.push_optimize_task(follower_id);
}
} }
// It's a new upper // It's a new upper
...@@ -1408,11 +1399,10 @@ impl AggregationUpdateQueue { ...@@ -1408,11 +1399,10 @@ impl AggregationUpdateQueue {
drop(upper); drop(upper);
let mut follower = ctx.task(new_follower_id, TaskDataCategory::Meta); let mut follower = ctx.task(new_follower_id, TaskDataCategory::Meta);
if update_count!(follower, Upper { task: upper_id }, 1) { if update_count!(follower, Upper { task: upper_id }, 1) {
if !upper_id.is_transient() { if !upper_id.is_transient()
#[allow(clippy::collapsible_if, reason = "readablility")] && update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two()
if update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two() { {
self.push_optimize_task(new_follower_id); self.push_optimize_task(new_follower_id);
}
} }
// It's a new upper // It's a new upper
let data = AggregatedDataUpdate::from_task(&mut follower); let data = AggregatedDataUpdate::from_task(&mut follower);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment