Skip to content

Commit 9732dcb

Browse files
bgwstipsan
authored andcommitted
chore(turbo-tasks-backend): Remove collapsible-if lints (vercel#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
1 parent 25e202e commit 9732dcb

File tree

1 file changed

+30
-40
lines changed

1 file changed

+30
-40
lines changed

turbopack/crates/turbo-tasks-backend/src/backend/operation/aggregation_update.rs

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -590,19 +590,16 @@ impl AggregationUpdateQueue {
590590
}
591591
self.inner_of_uppers_has_new_follower(ctx, new_follower_id, upper_ids);
592592
}
593-
} else {
594-
#[allow(clippy::collapsible_if, reason = "readablility")]
595-
if let Some(upper_id) = upper_ids.pop() {
596-
if !upper_ids.is_empty() {
597-
self.jobs.push_front(AggregationUpdateJobItem::new(
598-
AggregationUpdateJob::InnerOfUppersHasNewFollowers {
599-
upper_ids,
600-
new_follower_ids: new_follower_ids.clone(),
601-
},
602-
));
603-
}
604-
self.inner_of_upper_has_new_followers(ctx, new_follower_ids, upper_id);
593+
} else if let Some(upper_id) = upper_ids.pop() {
594+
if !upper_ids.is_empty() {
595+
self.jobs.push_front(AggregationUpdateJobItem::new(
596+
AggregationUpdateJob::InnerOfUppersHasNewFollowers {
597+
upper_ids,
598+
new_follower_ids: new_follower_ids.clone(),
599+
},
600+
));
605601
}
602+
self.inner_of_upper_has_new_followers(ctx, new_follower_ids, upper_id);
606603
}
607604
}
608605
AggregationUpdateJob::InnerOfUppersHasNewFollower {
@@ -647,19 +644,16 @@ impl AggregationUpdateQueue {
647644
}
648645
self.inner_of_uppers_lost_follower(ctx, lost_follower_id, upper_ids);
649646
}
650-
} else {
651-
#[allow(clippy::collapsible_if, reason = "readablility")]
652-
if let Some(upper_id) = upper_ids.pop() {
653-
if !upper_ids.is_empty() {
654-
self.jobs.push_front(AggregationUpdateJobItem::new(
655-
AggregationUpdateJob::InnerOfUppersLostFollowers {
656-
upper_ids,
657-
lost_follower_ids: lost_follower_ids.clone(),
658-
},
659-
));
660-
}
661-
self.inner_of_upper_lost_followers(ctx, lost_follower_ids, upper_id);
647+
} else if let Some(upper_id) = upper_ids.pop() {
648+
if !upper_ids.is_empty() {
649+
self.jobs.push_front(AggregationUpdateJobItem::new(
650+
AggregationUpdateJob::InnerOfUppersLostFollowers {
651+
upper_ids,
652+
lost_follower_ids: lost_follower_ids.clone(),
653+
},
654+
));
662655
}
656+
self.inner_of_upper_lost_followers(ctx, lost_follower_ids, upper_id);
663657
}
664658
}
665659
AggregationUpdateJob::InnerOfUppersLostFollower {
@@ -799,13 +793,11 @@ impl AggregationUpdateQueue {
799793

800794
// Add the same amount of upper edges
801795
if update_count!(task, Upper { task: upper_id }, count) {
802-
if !upper_id.is_transient() {
803-
#[allow(clippy::collapsible_if, reason = "readablility")]
804-
if update_ucount_and_get!(task, PersistentUpperCount, 1)
796+
if !upper_id.is_transient()
797+
&& update_ucount_and_get!(task, PersistentUpperCount, 1)
805798
.is_power_of_two()
806-
{
807-
self.push_optimize_task(task_id);
808-
}
799+
{
800+
self.push_optimize_task(task_id);
809801
}
810802
// When this is a new inner node, update aggregated data and
811803
// followers
@@ -1287,11 +1279,10 @@ impl AggregationUpdateQueue {
12871279
for &(follower_id, _) in followers_with_aggregation_number.iter() {
12881280
let mut follower = ctx.task(follower_id, TaskDataCategory::Meta);
12891281
if update_count!(follower, Upper { task: upper_id }, 1) {
1290-
if !upper_id.is_transient() {
1291-
#[allow(clippy::collapsible_if, reason = "readablility")]
1292-
if update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two() {
1293-
self.push_optimize_task(follower_id);
1294-
}
1282+
if !upper_id.is_transient()
1283+
&& update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two()
1284+
{
1285+
self.push_optimize_task(follower_id);
12951286
}
12961287

12971288
// It's a new upper
@@ -1408,11 +1399,10 @@ impl AggregationUpdateQueue {
14081399
drop(upper);
14091400
let mut follower = ctx.task(new_follower_id, TaskDataCategory::Meta);
14101401
if update_count!(follower, Upper { task: upper_id }, 1) {
1411-
if !upper_id.is_transient() {
1412-
#[allow(clippy::collapsible_if, reason = "readablility")]
1413-
if update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two() {
1414-
self.push_optimize_task(new_follower_id);
1415-
}
1402+
if !upper_id.is_transient()
1403+
&& update_ucount_and_get!(follower, PersistentUpperCount, 1).is_power_of_two()
1404+
{
1405+
self.push_optimize_task(new_follower_id);
14161406
}
14171407
// It's a new upper
14181408
let data = AggregatedDataUpdate::from_task(&mut follower);

0 commit comments

Comments
 (0)