Rename ModuleItem -> Item

This commit is contained in:
Aleksey Kladov 2020-07-30 00:23:03 +02:00
parent 16caadb404
commit 6636f56e79
17 changed files with 547 additions and 554 deletions

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,7 @@ pub trait ArgListOwner: AstNode {
}
pub trait ModuleItemOwner: AstNode {
fn items(&self) -> AstChildren<ast::ModuleItem> {
fn items(&self) -> AstChildren<ast::Item> {
support::children(self.syntax())
}
}

View file

@ -187,7 +187,7 @@ impl ast::Expr {
}
}
impl ast::ModuleItem {
impl ast::Item {
/// Returns `text`, parsed as an item, but only if it has no errors.
pub fn parse(text: &str) -> Result<Self, ()> {
parsing::parse_text_fragment(text, ra_parser::FragmentKind::Item)
@ -255,7 +255,7 @@ fn api_walkthrough() {
let mut func = None;
for item in file.items() {
match item {
ast::ModuleItem::FnDef(f) => func = Some(f),
ast::Item::FnDef(f) => func = Some(f),
_ => unreachable!(),
}
}

View file

@ -89,7 +89,7 @@ fn item_parser_tests() {
fragment_parser_dir_test(
&["parser/fragments/item/ok"],
&["parser/fragments/item/err"],
crate::ast::ModuleItem::parse,
crate::ast::Item::parse,
);
}