Open nrc opened 6 years ago
Ideas:
- better support for formatting parts of files
Under the current implementation, passing file_lines
is slow because it needs to parse the whole file and create an entire AST even though it only needs to format the specific lines. What's worse, it could be slower than formatting the whole file because it needs to check whether each line is within the given file lines parameter.
If we could be certain that the part of a file is a complete AST (e.g. formatting a group of imports), we could directly call format_snippet
or format_code_block
rather than full format_input
.
Just collecting ideas at this point. Some time around the 1.0 launch we should start prioritising and move discussion to the rustfmt repo.
cc @topecongiro