diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-28 11:28:31 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-28 11:28:31 +0000 |
commit | c30425dc96895117b644f29b758cee9dac36839b (patch) | |
tree | d3ccef4aa8f681cc9de29f0435ad20e87911a6ba /crates/ra_syntax/src/lib.rs | |
parent | a1fea0d34ee8f3436aefd87d4c133a7ff50ffbb0 (diff) | |
parent | 311cbbdad599d51c6f08f7dd72c299f7c0128bb2 (diff) |
Merge #3753
3753: Introduce stdx crate r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
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, |