diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-19 18:12:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-19 18:12:06 +0100 |
| commit | fb85ae5b9102ef39a4db7094aec409e3055c884d (patch) | |
| tree | 741f7dca2baa127b11b746a081e8ebd9f2e0faf6 | |
| parent | 7e330b8d622183696ddf3c7f8140c6510804e0a0 (diff) | |
| parent | 8bc993ba4de2d868441458295b13f5f7b71e0c73 (diff) | |
| download | sylt-fb85ae5b9102ef39a4db7094aec409e3055c884d.tar.gz | |
Merge pull request #77 from FredTheDino/one-call-to-print
debug_print: only make one 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!(); } |
