Skip to content

Commit bad285c

Browse files
committed
Pretty-printing uses CRLF on Windows. Closes rust-lang#14808.
1 parent 5c96369 commit bad285c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/libsyntax/print/pp.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,14 @@ impl<'a> Printer<'a> {
508508
}
509509
pub fn print_newline(&mut self, amount: isize) -> io::Result<()> {
510510
debug!("NEWLINE {}", amount);
511-
let ret = write!(self.out, "\n");
511+
let ret = if cfg!(windows) {
512+
self.out.write_all(b"\r\n")
513+
} else {
514+
self.out.write_all(b"\n")
515+
};
512516
self.pending_indentation = 0;
513517
self.indent(amount);
514-
return ret;
518+
ret
515519
}
516520
pub fn indent(&mut self, amount: isize) {
517521
debug!("INDENT {}", amount);

0 commit comments

Comments
 (0)