diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/expr_extensions.rs | 12 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index 2e50a095c..77cceb382 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs | |||
@@ -30,7 +30,7 @@ pub enum ElseBranch { | |||
30 | 30 | ||
31 | impl ast::IfExpr { | 31 | impl ast::IfExpr { |
32 | pub fn then_branch(&self) -> Option<ast::BlockExpr> { | 32 | pub fn then_branch(&self) -> Option<ast::BlockExpr> { |
33 | self.blocks().nth(0) | 33 | self.blocks().next() |
34 | } | 34 | } |
35 | pub fn else_branch(&self) -> Option<ElseBranch> { | 35 | pub fn else_branch(&self) -> Option<ElseBranch> { |
36 | let res = match self.blocks().nth(1) { | 36 | let res = match self.blocks().nth(1) { |
@@ -208,7 +208,7 @@ impl ast::BinExpr { | |||
208 | } | 208 | } |
209 | 209 | ||
210 | pub fn lhs(&self) -> Option<ast::Expr> { | 210 | pub fn lhs(&self) -> Option<ast::Expr> { |
211 | children(self).nth(0) | 211 | children(self).next() |
212 | } | 212 | } |
213 | 213 | ||
214 | pub fn rhs(&self) -> Option<ast::Expr> { | 214 | pub fn rhs(&self) -> Option<ast::Expr> { |
@@ -271,7 +271,7 @@ impl ast::RangeExpr { | |||
271 | 271 | ||
272 | impl ast::IndexExpr { | 272 | impl ast::IndexExpr { |
273 | pub fn base(&self) -> Option<ast::Expr> { | 273 | pub fn base(&self) -> Option<ast::Expr> { |
274 | children(self).nth(0) | 274 | children(self).next() |
275 | } | 275 | } |
276 | pub fn index(&self) -> Option<ast::Expr> { | 276 | pub fn index(&self) -> Option<ast::Expr> { |
277 | children(self).nth(1) | 277 | children(self).nth(1) |
@@ -287,7 +287,7 @@ impl ast::ArrayExpr { | |||
287 | pub fn kind(&self) -> ArrayExprKind { | 287 | pub fn kind(&self) -> ArrayExprKind { |
288 | if self.is_repeat() { | 288 | if self.is_repeat() { |
289 | ArrayExprKind::Repeat { | 289 | ArrayExprKind::Repeat { |
290 | initializer: children(self).nth(0), | 290 | initializer: children(self).next(), |
291 | repeat: children(self).nth(1), | 291 | repeat: children(self).nth(1), |
292 | } | 292 | } |
293 | } else { | 293 | } else { |
@@ -328,10 +328,10 @@ impl ast::Literal { | |||
328 | } | 328 | } |
329 | 329 | ||
330 | pub fn kind(&self) -> LiteralKind { | 330 | pub fn kind(&self) -> LiteralKind { |
331 | const INT_SUFFIXES: [&'static str; 12] = [ | 331 | const INT_SUFFIXES: [&str; 12] = [ |
332 | "u64", "u32", "u16", "u8", "usize", "isize", "i64", "i32", "i16", "i8", "u128", "i128", | 332 | "u64", "u32", "u16", "u8", "usize", "isize", "i64", "i32", "i16", "i8", "u128", "i128", |
333 | ]; | 333 | ]; |
334 | const FLOAT_SUFFIXES: [&'static str; 2] = ["f32", "f64"]; | 334 | const FLOAT_SUFFIXES: [&str; 2] = ["f32", "f64"]; |
335 | 335 | ||
336 | let token = self.token(); | 336 | let token = self.token(); |
337 | 337 | ||
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 89d1403e7..7c20fcc10 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -152,7 +152,7 @@ pub fn match_arm_list(arms: impl IntoIterator<Item = ast::MatchArm>) -> ast::Mat | |||
152 | format!(" {}{}\n", arm.syntax(), comma) | 152 | format!(" {}{}\n", arm.syntax(), comma) |
153 | }) | 153 | }) |
154 | .collect::<String>(); | 154 | .collect::<String>(); |
155 | return from_text(&format!("{}", arms_str)); | 155 | return from_text(&arms_str); |
156 | 156 | ||
157 | fn from_text(text: &str) -> ast::MatchArmList { | 157 | fn from_text(text: &str) -> ast::MatchArmList { |
158 | ast_from_text(&format!("fn f() {{ match () {{\n{}}} }}", text)) | 158 | ast_from_text(&format!("fn f() {{ match () {{\n{}}} }}", text)) |