diff options
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index ac59455e7..8a4d45386 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -187,14 +187,14 @@ impl ast::Expr { | |||
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | impl ast::ModuleItem { | 190 | impl ast::Item { |
191 | /// Returns `text`, parsed as an item, but only if it has no errors. | 191 | /// Returns `text`, parsed as an item, but only if it has no errors. |
192 | pub fn parse(text: &str) -> Result<Self, ()> { | 192 | pub fn parse(text: &str) -> Result<Self, ()> { |
193 | parsing::parse_text_fragment(text, ra_parser::FragmentKind::Item) | 193 | parsing::parse_text_fragment(text, ra_parser::FragmentKind::Item) |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | impl ast::TypeRef { | 197 | impl ast::Type { |
198 | /// Returns `text`, parsed as an type reference, but only if it has no errors. | 198 | /// Returns `text`, parsed as an type reference, but only if it has no errors. |
199 | pub fn parse(text: &str) -> Result<Self, ()> { | 199 | pub fn parse(text: &str) -> Result<Self, ()> { |
200 | parsing::parse_text_fragment(text, ra_parser::FragmentKind::Type) | 200 | parsing::parse_text_fragment(text, ra_parser::FragmentKind::Type) |
@@ -255,11 +255,11 @@ fn api_walkthrough() { | |||
255 | let mut func = None; | 255 | let mut func = None; |
256 | for item in file.items() { | 256 | for item in file.items() { |
257 | match item { | 257 | match item { |
258 | ast::ModuleItem::FnDef(f) => func = Some(f), | 258 | ast::Item::Fn(f) => func = Some(f), |
259 | _ => unreachable!(), | 259 | _ => unreachable!(), |
260 | } | 260 | } |
261 | } | 261 | } |
262 | let func: ast::FnDef = func.unwrap(); | 262 | let func: ast::Fn = func.unwrap(); |
263 | 263 | ||
264 | // Each AST node has a bunch of getters for children. All getters return | 264 | // Each AST node has a bunch of getters for children. All getters return |
265 | // `Option`s though, to account for incomplete code. Some getters are common | 265 | // `Option`s though, to account for incomplete code. Some getters are common |
@@ -316,7 +316,7 @@ fn api_walkthrough() { | |||
316 | ); | 316 | ); |
317 | 317 | ||
318 | // As well as some iterator helpers: | 318 | // As well as some iterator helpers: |
319 | let f = expr_syntax.ancestors().find_map(ast::FnDef::cast); | 319 | let f = expr_syntax.ancestors().find_map(ast::Fn::cast); |
320 | assert_eq!(f, Some(func)); | 320 | assert_eq!(f, Some(func)); |
321 | assert!(expr_syntax.siblings_with_tokens(Direction::Next).any(|it| it.kind() == T!['}'])); | 321 | assert!(expr_syntax.siblings_with_tokens(Direction::Next).any(|it| it.kind() == T!['}'])); |
322 | assert_eq!( | 322 | assert_eq!( |