rust-dev-tools / dev-tools-team

resources for the Rust dev-tools team
42 stars 9 forks source link

Rustfmt post-1.0 roadmap #36

Open nrc opened 6 years ago

nrc commented 6 years ago

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

nrc commented 6 years ago

Ideas:

topecongiro commented 6 years ago
  • 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.