Skip to content

Commit b53ac2f

Browse files
committed
improve readablility
1 parent fb43d53 commit b53ac2f

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

crates/next-api/src/app.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -969,17 +969,21 @@ impl AppProject {
969969
.turbopack_remove_unused_imports(next_mode)
970970
.await?;
971971

972-
let binding_usage_info = remove_unused_imports.then(|| {
973-
compute_binding_usage_info(
974-
ModuleGraph::from_graphs(graphs.clone()),
972+
let (full, binding_usage_info) = if remove_unused_imports {
973+
let full_with_unused_references = ModuleGraph::from_graphs(graphs.clone());
974+
let binding_usage_info = compute_binding_usage_info(
975+
full_with_unused_references,
975976
should_read_binding_usage,
977+
);
978+
(
979+
ModuleGraph::from_graphs_without_unused_references(
980+
graphs,
981+
binding_usage_info,
982+
),
983+
Some(binding_usage_info),
976984
)
977-
});
978-
979-
let full = if let Some(binding_usage_info) = binding_usage_info {
980-
ModuleGraph::from_graphs_without_unused_references(graphs, binding_usage_info)
981985
} else {
982-
ModuleGraph::from_graphs(graphs)
986+
(ModuleGraph::from_graphs(graphs), None)
983987
};
984988

985989
Ok(BaseAndFullModuleGraph {

0 commit comments

Comments
 (0)