aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/edit.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated.rs3
-rw-r--r--crates/ra_syntax/src/ast/make.rs3
-rw-r--r--crates/ra_syntax/src/grammar.ron6
4 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 95bf9db14..ae5d63927 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -104,7 +104,7 @@ impl ast::ItemList {
104 } 104 }
105 }; 105 };
106 106
107 let indent = leading_indent(self.syntax()).unwrap_or("".into()); 107 let indent = leading_indent(self.syntax()).unwrap_or_default();
108 let ws = tokens::WsBuilder::new(&format!("\n{}", indent)); 108 let ws = tokens::WsBuilder::new(&format!("\n{}", indent));
109 let to_insert = iter::once(ws.ws().into()); 109 let to_insert = iter::once(ws.ws().into());
110 match existing_ws { 110 match existing_ws {
@@ -133,7 +133,7 @@ impl ast::RecordFieldList {
133 let space = if is_multiline { 133 let space = if is_multiline {
134 ws = tokens::WsBuilder::new(&format!( 134 ws = tokens::WsBuilder::new(&format!(
135 "\n{} ", 135 "\n{} ",
136 leading_indent(self.syntax()).unwrap_or("".into()) 136 leading_indent(self.syntax()).unwrap_or_default()
137 )); 137 ));
138 ws.ws() 138 ws.ws()
139 } else { 139 } else {
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index b917f77fe..9f9d6e63c 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1456,6 +1456,9 @@ impl LambdaExpr {
1456 pub fn param_list(&self) -> Option<ParamList> { 1456 pub fn param_list(&self) -> Option<ParamList> {
1457 AstChildren::new(&self.syntax).next() 1457 AstChildren::new(&self.syntax).next()
1458 } 1458 }
1459 pub fn ret_type(&self) -> Option<RetType> {
1460 AstChildren::new(&self.syntax).next()
1461 }
1459 pub fn body(&self) -> Option<Expr> { 1462 pub fn body(&self) -> Option<Expr> {
1460 AstChildren::new(&self.syntax).next() 1463 AstChildren::new(&self.syntax).next()
1461 } 1464 }
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 40db570da..04a5408fe 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -168,8 +168,7 @@ pub fn let_stmt(pattern: ast::Pat, initializer: Option<ast::Expr>) -> ast::LetSt
168 168
169fn ast_from_text<N: AstNode>(text: &str) -> N { 169fn ast_from_text<N: AstNode>(text: &str) -> N {
170 let parse = SourceFile::parse(text); 170 let parse = SourceFile::parse(text);
171 let res = parse.tree().syntax().descendants().find_map(N::cast).unwrap(); 171 parse.tree().syntax().descendants().find_map(N::cast).unwrap()
172 res
173} 172}
174 173
175pub mod tokens { 174pub mod tokens {
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index d6802b6fb..08aafb610 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -94,7 +94,8 @@ Grammar(
94 "return", 94 "return",
95 "try", 95 "try",
96 "box", 96 "box",
97 "await" 97 "await",
98 "macro"
98 ], 99 ],
99 contextual_keywords: [ 100 contextual_keywords: [
100 "auto", 101 "auto",
@@ -140,6 +141,7 @@ Grammar(
140 "TYPE_ALIAS_DEF", 141 "TYPE_ALIAS_DEF",
141 "MACRO_CALL", 142 "MACRO_CALL",
142 "TOKEN_TREE", 143 "TOKEN_TREE",
144 "MACRO_DEF",
143 145
144 "PAREN_TYPE", 146 "PAREN_TYPE",
145 "TUPLE_TYPE", 147 "TUPLE_TYPE",
@@ -427,7 +429,7 @@ Grammar(
427 "PathExpr": (options: ["Path"]), 429 "PathExpr": (options: ["Path"]),
428 "LambdaExpr": ( 430 "LambdaExpr": (
429 options: [ 431 options: [
430 "ParamList", 432 "ParamList", "RetType",
431 ["body", "Expr"], 433 ["body", "Expr"],
432 ] 434 ]
433 ), 435 ),