diff --git a/crates/ra_analysis/src/completion/mod.rs b/crates/ra_analysis/src/completion/mod.rs index 8034060de34..c7717ab615b 100644 --- a/crates/ra_analysis/src/completion/mod.rs +++ b/crates/ra_analysis/src/completion/mod.rs @@ -224,7 +224,7 @@ fn test_completion_mod_scope_no_self_use() { fn test_completion_self_path() { check_scope_completion( r" - use self::m::B<|>; + use self::m::<|>; mod m { struct Bar; diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/descriptors/module/mod.rs index a7e41e3db38..acc6c1c5a1c 100644 --- a/crates/ra_analysis/src/descriptors/module/mod.rs +++ b/crates/ra_analysis/src/descriptors/module/mod.rs @@ -110,6 +110,7 @@ pub fn crate_root(&self) -> ModuleDescriptor { } /// `name` is `None` for the crate's root module + #[allow(unused)] pub fn name(&self) -> Option { let link = self.module_id.parent_link(&self.tree)?; Some(link.name(&self.tree)) diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index ff4e8303de6..c6b1161595e 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs @@ -148,12 +148,7 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>( syntax: SyntaxNodeRef<'a>, offset: TextUnit, ) -> Option { - let leaves = find_leaf_at_offset(syntax, offset); - let leaf = leaves - .clone() - .find(|leaf| !leaf.kind().is_trivia()) - .or_else(|| leaves.right_biased())?; - leaf.ancestors().filter_map(N::cast).next() + find_leaf_at_offset(syntax, offset).find_map(|leaf| leaf.ancestors().find_map(N::cast)) } #[cfg(test)] diff --git a/crates/ra_syntax/src/grammar/items/mod.rs b/crates/ra_syntax/src/grammar/items/mod.rs index 06c6b5e6ebf..68226690809 100644 --- a/crates/ra_syntax/src/grammar/items/mod.rs +++ b/crates/ra_syntax/src/grammar/items/mod.rs @@ -29,7 +29,7 @@ pub(super) enum ItemFlavor { Trait, } -const ITEM_RECOVERY_SET: TokenSet = token_set![ +pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![ FN_KW, STRUCT_KW, ENUM_KW, IMPL_KW, TRAIT_KW, CONST_KW, STATIC_KW, LET_KW, MOD_KW, PUB_KW, CRATE_KW ]; diff --git a/crates/ra_syntax/src/grammar/paths.rs b/crates/ra_syntax/src/grammar/paths.rs index a35a339ccac..33a11886cb3 100644 --- a/crates/ra_syntax/src/grammar/paths.rs +++ b/crates/ra_syntax/src/grammar/paths.rs @@ -78,7 +78,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) { // use crate::foo; SELF_KW | SUPER_KW | CRATE_KW => p.bump(), _ => { - p.err_and_bump("expected identifier"); + p.err_recover("expected identifier", items::ITEM_RECOVERY_SET); } }; }