Deduplicate grouped vs individual imports on entity merge (#2947) (#3163)
When regenerating entities with --preserve-user-modifications, the merge
deduplicated whole use statements by structural equality. A user-grouped
import (use foo::{A, B}) was therefore not recognised as equivalent to the
freshly generated individual imports (use foo::A; use foo::B;), so both were
emitted, producing duplicate imports.
Dedup at the individual import-leaf level instead: flatten each use tree into
canonical leaf paths and drop a statement only when all of its leaves have
already been imported. Non-overlapping grouped imports are still preserved
verbatim (covered by the existing complex_use test). C
Chris Tsang committed
90f4da0e00cd1b75709f67b25baf825a09039dad
Parent: b194ee0
Committed by GitHub <noreply@github.com>
on 8/8/2026, 5:10:10 PM