mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Rename ModuleItem -> Item
This commit is contained in:
parent
16caadb404
commit
6636f56e79
17 changed files with 547 additions and 554 deletions
File diff suppressed because it is too large
Load diff
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue