mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Add and use HirFormatter::write_{str,char}
This commit is contained in:
parent
f4e4a3a896
commit
bd570903b0
2 changed files with 64 additions and 55 deletions
|
@ -172,6 +172,16 @@ impl<'a> HirFormatter<'a> {
|
|||
self.fmt.write_str(&self.buf).map_err(HirDisplayError::from)
|
||||
}
|
||||
|
||||
pub fn write_str(&mut self, s: &str) -> Result<(), HirDisplayError> {
|
||||
self.fmt.write_str(s)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn write_char(&mut self, c: char) -> Result<(), HirDisplayError> {
|
||||
self.fmt.write_char(c)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn should_truncate(&self) -> bool {
|
||||
match self.max_size {
|
||||
Some(max_size) => self.curr_size >= max_size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue