Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some more cleanups to syntax::print #62532

Merged
merged 30 commits into from
Jul 11, 2019

Commits on Jul 10, 2019

  1. Configuration menu
    Copy the full SHA
    9b0ebfa View commit details
    Browse the repository at this point in the history
  2. Remove duplicate attr_to_string

    attribute_to_string exists.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    0f10d11 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a440337 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    11d5216 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ae5ed9b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4483980 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a573d14 View commit details
    Browse the repository at this point in the history
  8. Stop Option-wrapping comments

    We always check against the length before indexing anyway.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    59b161c View commit details
    Browse the repository at this point in the history
  9. Inline State::new

    There was only one callsite for each and this removes the
    unwrap_or_default's on the comments argument
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    9b5e397 View commit details
    Browse the repository at this point in the history
  10. Combine comment-handling logic into struct

    This also permits sharing the underlying code between pprust and
    hir::print.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    0eb2e56 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    7e37914 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    e0db2e6 View commit details
    Browse the repository at this point in the history
  13. Inline State::new_from_input in pprust

    This function took too many arguments and are simple on the inside;
    inlining them makes complexity go down.
    
    hir::print's copy is unfortunately used from librustc_driver so inlining
    it is not as straightforward.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    e0ffa7c View commit details
    Browse the repository at this point in the history
  14. Move pp::Printer out field to owned String

    This enforces that eof() must be called to get the String out, and
    generally is better from an API perspective. No users of pretty printing
    pre-allocate the buffer.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    00ca508 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    4c58fc3 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    ccf279d View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    cd2d832 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    55a6a76 View commit details
    Browse the repository at this point in the history
  19. Simplify print_end

    Presumably the code was from an older age of Rust and can now be written
    much simpler.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    57cf7a2 View commit details
    Browse the repository at this point in the history
  20. Remove is_begin/is_end functions from PrintState

    These are somewhat ambiguous (beginning/end of what?) so it's better to
    inline their one use into the code.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    4783d9e View commit details
    Browse the repository at this point in the history
  21. Rename pretty_print_* to scan_* to follow naming in the paper

    This is also easier to understand because the scan and print "tasks" are
    separate, but previously were both called "print" or "pretty print."
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    5879146 View commit details
    Browse the repository at this point in the history
  22. Drop length from Token::String

    It was always set to the string's length
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    04b80a5 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    39aa9bf View commit details
    Browse the repository at this point in the history
  24. Rename is_bol -> is_beginning_of_line

    Also moves it to pp::Printer from PrintState.
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    e91dbc5 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    cab4532 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    daf1b29 View commit details
    Browse the repository at this point in the history
  27. Remove needless indent arguments

    We're always indenting by INDENT_UNIT anyway
    Mark-Simulacrum committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    63fdf1a View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    73c1752 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    096cb41 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    56a9237 View commit details
    Browse the repository at this point in the history