about summary refs log tree commit diff
path: root/src/libsyntax/print
AgeCommit message (Collapse)AuthorLines
2019-07-15pprust: Remove the box from `print_tts`Vadim Petrochenkov-2/+4
Wrap the whole attribute into a box instead
2019-07-15pprust: Use `print_mac_common` for delimited token groupsVadim Petrochenkov-27/+33
2019-07-15pprust: Use `print_mac_common` for attributesVadim Petrochenkov-4/+18
2019-07-15pprust: Use `print_mac_common` for `macro_rules` definitionsVadim Petrochenkov-26/+16
2019-07-15pprust: Move some methods to the `PrintState` traitVadim Petrochenkov-135/+132
So that path and macro argument printing code can be shared
2019-07-12Use snippet instead of pprinting statementEsteban Küber-2/+1
2019-07-11Address review commentsVadim Petrochenkov-9/+10
2019-07-11pretty-print: Merge `print_tts` and `print_tts_ext`Vadim Petrochenkov-10/+6
2019-07-11pretty-print: Do not lose the `$crate` printing flag in `print_tt`Vadim Petrochenkov-1/+1
2019-07-10File is now short enough for tidyMark Rousskov-2/+0
2019-07-10Remove writer function from PrintStateMark Rousskov-37/+32
2019-07-10Use constant instead of magic numberMark Rousskov-1/+1
2019-07-10Remove needless indent argumentsMark Rousskov-11/+8
We're always indenting by INDENT_UNIT anyway
2019-07-10Move pp::Printer helpers to direct implMark Rousskov-45/+49
2019-07-10Rename is_bol -> is_beginning_of_lineMark Rousskov-10/+9
Also moves it to pp::Printer from PrintState.
2019-07-10Remove needless indirection in bcloseMark Rousskov-6/+2
2019-07-10Drop length from Token::StringMark Rousskov-12/+15
It was always set to the string's length
2019-07-10Rename pretty_print_* to scan_* to follow naming in the paperMark Rousskov-11/+11
This is also easier to understand because the scan and print "tasks" are separate, but previously were both called "print" or "pretty print."
2019-07-10Remove is_begin/is_end functions from PrintStateMark Rousskov-16/+4
These are somewhat ambiguous (beginning/end of what?) so it's better to inline their one use into the code.
2019-07-10Simplify print_endMark Rousskov-3/+1
Presumably the code was from an older age of Rust and can now be written much simpler.
2019-07-10Simplify check_stack implementationMark Rousskov-7/+7
2019-07-10Move BufEntry assignment into scan_pushMark Rousskov-12/+7
2019-07-10Remove useless call to indentMark Rousskov-1/+0
2019-07-10Fully privatize (vs. crate visibility) functionsMark Rousskov-18/+18
2019-07-10Move pp::Printer out field to owned StringMark Rousskov-26/+21
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.
2019-07-10Inline State::new_from_input in pprustMark Rousskov-18/+6
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.
2019-07-10print_crate returns String instead of taking an out pointerMark Rousskov-4/+5
2019-07-10Replace src: &mut dyn Read with StringMark Rousskov-3/+2
2019-07-10Combine comment-handling logic into structMark Rousskov-37/+57
This also permits sharing the underlying code between pprust and hir::print.
2019-07-10Inline State::newMark Rousskov-9/+1
There was only one callsite for each and this removes the unwrap_or_default's on the comments argument
2019-07-10Stop Option-wrapping commentsMark Rousskov-14/+10
We always check against the length before indexing anyway.
2019-07-10Remove unused boxes vectorMark Rousskov-12/+0
2019-07-10Privatize and remove unused functionsMark Rousskov-19/+9
2019-07-10Move lifetime_to_string to Display implMark Rousskov-4/+0
2019-07-10Remove unused arm_to_stringMark Rousskov-4/+0
2019-07-10Remove duplicate attr_to_stringMark Rousskov-4/+0
attribute_to_string exists.
2019-07-10Move literal_to_string to fmt::DisplayMark Rousskov-5/+1
2019-07-09Pretty-print `$crate` as `crate`/`::my_crate` in tokensVadim Petrochenkov-47/+62
...but only if those tokens are printed from inside of AST pretty-printing.
2019-06-29Inline rust_printerMark Rousskov-14/+9
2019-06-29Remove unused importMark Rousskov-1/+0
2019-06-29Remove io::Result from syntax::printMark Rousskov-1153/+1072
Since we're now writing directly to the vector, there's no need to thread results through the whole printing infrastructure
2019-06-29Replace pretty-printer Box<dyn Write> with &mut StringMark Rousskov-31/+22
2019-06-29Delete now-unused methodsMark Rousskov-53/+0
2019-06-29Privatize a bunch of methodsMark Rousskov-96/+96
2019-06-26Fix clippy::print_with_newlineIgor Matuszewski-1/+1
2019-06-24Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkovbors-8/+4
Remove `ast::Guard` With the introduction of `ast::ExprKind::Let` in https://github.com/rust-lang/rust/pull/60861, the `ast::Guard` structure is now redundant in terms of representing [`if let` guards](https://github.com/rust-lang/rust/issues/51114) in AST since it can be represented by `ExprKind::Let` syntactically. Therefore, we remove `ast::Guard` here. However, we keep `hir::Guard` because the semantic representation is a different matter and this story is more unclear right now (might involve `goto 'arm` in HIR or something...). r? @petrochenkov
2019-06-23Remove redundant syntax::ast::Guard.Mazdak Farrokhzad-8/+4
2019-06-23let_chains: Fix bugs in pretty printing.Mazdak Farrokhzad-12/+28
2019-06-23let_chains: Handle it in AST pretty printing.Mazdak Farrokhzad-40/+14
2019-06-18Remove the HirId/NodeId from where clausesMatthew Jasper-1/+0
Also give them a span in the HIR