diff options
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index cef926ed3..f0e16dc2b 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -32,9 +32,10 @@ pub mod ast; | |||
32 | #[doc(hidden)] | 32 | #[doc(hidden)] |
33 | pub mod fuzz; | 33 | pub mod fuzz; |
34 | 34 | ||
35 | use std::{fmt::Write, marker::PhantomData, sync::Arc}; | 35 | use std::{marker::PhantomData, sync::Arc}; |
36 | 36 | ||
37 | use ra_text_edit::AtomTextEdit; | 37 | use ra_text_edit::AtomTextEdit; |
38 | use stdx::format_to; | ||
38 | 39 | ||
39 | use crate::syntax_node::GreenNode; | 40 | use crate::syntax_node::GreenNode; |
40 | 41 | ||
@@ -115,7 +116,7 @@ impl Parse<SourceFile> { | |||
115 | pub fn debug_dump(&self) -> String { | 116 | pub fn debug_dump(&self) -> String { |
116 | let mut buf = format!("{:#?}", self.tree().syntax()); | 117 | let mut buf = format!("{:#?}", self.tree().syntax()); |
117 | for err in self.errors.iter() { | 118 | for err in self.errors.iter() { |
118 | writeln!(buf, "error {:?}: {}", err.range(), err).unwrap(); | 119 | format_to!(buf, "error {:?}: {}\n", err.range(), err); |
119 | } | 120 | } |
120 | buf | 121 | buf |
121 | } | 122 | } |
@@ -296,7 +297,7 @@ fn api_walkthrough() { | |||
296 | NodeOrToken::Node(it) => it.text().to_string(), | 297 | NodeOrToken::Node(it) => it.text().to_string(), |
297 | NodeOrToken::Token(it) => it.text().to_string(), | 298 | NodeOrToken::Token(it) => it.text().to_string(), |
298 | }; | 299 | }; |
299 | buf += &format!("{:indent$}{:?} {:?}\n", " ", text, node.kind(), indent = indent); | 300 | format_to!(buf, "{:indent$}{:?} {:?}\n", " ", text, node.kind(), indent = indent); |
300 | indent += 2; | 301 | indent += 2; |
301 | } | 302 | } |
302 | WalkEvent::Leave(_) => indent -= 2, | 303 | WalkEvent::Leave(_) => indent -= 2, |