cl-typeck: Refactor display for Def.

- Use the FmtAdapter from cl-ast
  - Add a new delimiter-constructing delimit_with function.
This commit is contained in:
2024-07-21 01:46:20 -05:00
parent 46bd44bd99
commit 82b71e2517
4 changed files with 51 additions and 47 deletions

View File

@@ -1,4 +1,3 @@
use delimiters::Delimiters;
use std::fmt::Write;
@@ -7,9 +6,14 @@ pub trait FmtAdapter: Write {
fn indent(&mut self) -> Indent<Self> {
Indent { f: self }
}
fn delimit(&mut self, delim: Delimiters) -> Delimit<Self> {
Delimit::new(self, delim)
}
fn delimit_with(&mut self, open: &'static str, close: &'static str) -> Delimit<Self> {
Delimit::new(self, Delimiters { open, close })
}
}
/// Pads text with leading indentation after every newline