Updated build_new_use_lines to accept the trailing_comments map as a third parameter.
If your existing tests only pass two arguments, just add &BTreeMap::new() as the third.
The key fix: remove the trim_start() on the remainder.
We want to preserve leading blank lines in the remainder so that if
there was a blank line after some block comment, it stays in the final output.
Detects a same-line trailing // comment starting just after offset pos
(e.g. after the semicolon). If found, returns (comment_text, total_length)
so we can store that comment text and expand the removal range.
If none found, returns None.
Now we always return three items: (grouped_map, comment_map, trailing_comments).
If you have code/tests that only care about grouped_map & comment_map,
just destructure as:
let (grouped_map, comment_map, _trailing) = group_and_sort_uses(…);
ignoring the trailing_comments value.