Skip to content

Commit ebaad38

Browse files
authored
Move OutputAssets length check into new method (vercel/turborepo#6194)
### Description vercel/turborepo#6191 (comment) ### Testing Instructions <!-- Give a quick description of steps to test your changes. --> Closes WEB-1793
1 parent e99b3ac commit ebaad38

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/turbopack-core/src/chunk/chunk_group.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,5 @@ async fn references_to_output_assets(
182182
.copied()
183183
.filter(|&asset| set.insert(asset))
184184
.collect::<Vec<_>>();
185-
Ok(if output_assets.is_empty() {
186-
OutputAssets::empty()
187-
} else {
188-
OutputAssets::new(output_assets)
189-
})
185+
Ok(OutputAssets::new(output_assets))
190186
}

crates/turbopack-core/src/output.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ pub struct OutputAssets(Vec<Vc<Box<dyn OutputAsset>>>);
2525
impl OutputAssets {
2626
#[turbo_tasks::function]
2727
pub fn new(assets: Vec<Vc<Box<dyn OutputAsset>>>) -> Vc<Self> {
28-
Vc::cell(assets)
28+
if assets.is_empty() {
29+
OutputAssets::empty()
30+
} else {
31+
Vc::cell(assets)
32+
}
2933
}
3034

3135
#[turbo_tasks::function]

0 commit comments

Comments
 (0)