Skip to content

Commit 4783d9e

Browse files
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.
1 parent 57cf7a2 commit 4783d9e

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/libsyntax/print/pprust.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -445,20 +445,6 @@ pub trait PrintState<'a> {
445445

446446
fn pclose(&mut self) { self.writer().word(")") }
447447

448-
fn is_begin(&mut self) -> bool {
449-
match self.writer().last_token() {
450-
pp::Token::Begin(_) => true,
451-
_ => false,
452-
}
453-
}
454-
455-
fn is_end(&mut self) -> bool {
456-
match self.writer().last_token() {
457-
pp::Token::End => true,
458-
_ => false,
459-
}
460-
}
461-
462448
// is this the beginning of a line?
463449
fn is_bol(&mut self) -> bool {
464450
self.writer().last_token().is_eof() || self.writer().last_token().is_hardbreak_tok()
@@ -545,11 +531,13 @@ pub trait PrintState<'a> {
545531
}
546532
comments::BlankLine => {
547533
// We need to do at least one, possibly two hardbreaks.
548-
let is_semi = match self.writer().last_token() {
534+
let twice = match self.writer().last_token() {
549535
pp::Token::String(s, _) => ";" == s,
536+
pp::Token::Begin(_) => true,
537+
pp::Token::End => true,
550538
_ => false
551539
};
552-
if is_semi || self.is_begin() || self.is_end() {
540+
if twice {
553541
self.writer().hardbreak();
554542
}
555543
self.writer().hardbreak();

0 commit comments

Comments
 (0)