]> git.proxmox.com Git - rustc.git/blame - src/libsyntax/print/helpers.rs
New upstream version 1.42.0+dfsg1
[rustc.git] / src / libsyntax / print / helpers.rs
CommitLineData
416331ca 1use crate::print::pp::Printer;
dfeec247 2use std::borrow::Cow;
416331ca
XL
3
4impl Printer {
5 pub fn word_space<W: Into<Cow<'static, str>>>(&mut self, w: W) {
6 self.word(w);
7 self.space();
8 }
9
10 pub fn popen(&mut self) {
11 self.word("(");
12 }
13
14 pub fn pclose(&mut self) {
15 self.word(")");
16 }
17
18 pub fn hardbreak_if_not_bol(&mut self) {
19 if !self.is_beginning_of_line() {
20 self.hardbreak()
21 }
22 }
23
24 pub fn space_if_not_bol(&mut self) {
dfeec247
XL
25 if !self.is_beginning_of_line() {
26 self.space();
27 }
416331ca
XL
28 }
29
dfeec247
XL
30 pub fn nbsp(&mut self) {
31 self.word(" ")
32 }
416331ca
XL
33
34 pub fn word_nbsp<S: Into<Cow<'static, str>>>(&mut self, w: S) {
35 self.word(w);
36 self.nbsp()
37 }
38}