aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_fmt
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_fmt')
-rw-r--r--crates/ra_fmt/src/lib.rs27
1 files changed, 1 insertions, 26 deletions
diff --git a/crates/ra_fmt/src/lib.rs b/crates/ra_fmt/src/lib.rs
index d0004654b..b92477f9e 100644
--- a/crates/ra_fmt/src/lib.rs
+++ b/crates/ra_fmt/src/lib.rs
@@ -4,9 +4,7 @@ use std::iter::successors;
4 4
5use syntax::{ 5use syntax::{
6 ast::{self, AstToken}, 6 ast::{self, AstToken},
7 SmolStr, SyntaxKind, 7 SmolStr, SyntaxNode, SyntaxToken,
8 SyntaxKind::*,
9 SyntaxNode, SyntaxToken, T,
10}; 8};
11 9
12/// If the node is on the beginning of the line, calculate indent. 10/// If the node is on the beginning of the line, calculate indent.
@@ -28,26 +26,3 @@ pub fn leading_indent(node: &SyntaxNode) -> Option<SmolStr> {
28fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> { 26fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> {
29 successors(token.prev_token(), |token| token.prev_token()) 27 successors(token.prev_token(), |token| token.prev_token())
30} 28}
31
32pub fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str {
33 match left {
34 T!['('] | T!['['] => return "",
35 T!['{'] => {
36 if let USE_TREE = right {
37 return "";
38 }
39 }
40 _ => (),
41 }
42 match right {
43 T![')'] | T![']'] => return "",
44 T!['}'] => {
45 if let USE_TREE = left {
46 return "";
47 }
48 }
49 T![.] => return "",
50 _ => (),
51 }
52 " "
53}