diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-02-19 18:06:17 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-02-19 18:06:17 +0100 |
| commit | 8bc993ba4de2d868441458295b13f5f7b71e0c73 (patch) | |
| tree | 721c58f729ace1ecda13b2be574555612bf38cdb | |
| parent | 5241e1243f285742a76289e53982587f2b9cb603 (diff) | |
| download | sylt-one-call-to-print.tar.gz | |
debug_print: only make one call to printone-call-to-print
| -rw-r--r-- | src/lib.rs | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -694,14 +694,14 @@ impl Block { pub fn debug_print(&self) { println!(" === {} ===", self.name.blue()); for (i, s) in self.ops.iter().enumerate() { - // TODO(ed): This print should only do one call to print. - // Otherwise we can get race conditions in a single line. - if self.line_offsets.contains_key(&i) { - print!("{:5} ", self.line_offsets[&i].red()); - } else { - print!(" {} ", "|".red()); - } - println!("{:05} {:?}", i.blue(), s); + println!("{}{}", + if self.line_offsets.contains_key(&i) { + format!("{:5} ", self.line_offsets[&i].red()) + } else { + format!(" {} ", "|".red()) + }, + format!("{:05} {:?}", i.blue(), s) + ); } println!(); } |
