aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-04-07 16:59:09 +0100
committerBenjamin Coenen <[email protected]>2020-04-07 16:59:09 +0100
commit18a5e164838e1dc2abcc6b79d4fc2f96ffd2507c (patch)
treebc80b5c49c3b7ba31c7fe967bb34fe14bac9d5ed /crates/ra_hir
parentab864ed259c10ff51f7c9c3421d098eeea7b0245 (diff)
parent33c364b545350134b945fbca834194fd1a28fe08 (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/diagnostics.rs2
-rw-r--r--crates/ra_hir/src/semantics.rs2
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs18
3 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs
index a9040ea3d..c82883d0c 100644
--- a/crates/ra_hir/src/diagnostics.rs
+++ b/crates/ra_hir/src/diagnostics.rs
@@ -1,4 +1,4 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2pub use hir_def::diagnostics::UnresolvedModule; 2pub use hir_def::diagnostics::UnresolvedModule;
3pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink}; 3pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink};
4pub use hir_ty::diagnostics::{MissingFields, MissingOkInTailExpr, NoSuchField}; 4pub use hir_ty::diagnostics::{MissingFields, MissingMatchArms, MissingOkInTailExpr, NoSuchField};
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 16a5fe968..2ad231d36 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -9,6 +9,7 @@ use hir_def::{
9 AsMacroCall, TraitId, 9 AsMacroCall, TraitId,
10}; 10};
11use hir_expand::ExpansionInfo; 11use hir_expand::ExpansionInfo;
12use itertools::Itertools;
12use ra_db::{FileId, FileRange}; 13use ra_db::{FileId, FileRange};
13use ra_prof::profile; 14use ra_prof::profile;
14use ra_syntax::{ 15use ra_syntax::{
@@ -135,7 +136,6 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
135 node: &SyntaxNode, 136 node: &SyntaxNode,
136 offset: TextUnit, 137 offset: TextUnit,
137 ) -> impl Iterator<Item = SyntaxNode> + '_ { 138 ) -> impl Iterator<Item = SyntaxNode> + '_ {
138 use itertools::Itertools;
139 node.token_at_offset(offset) 139 node.token_at_offset(offset)
140 .map(|token| self.ancestors_with_macros(token.parent())) 140 .map(|token| self.ancestors_with_macros(token.parent()))
141 .kmerge_by(|node1, node2| node1.text_range().len() < node2.text_range().len()) 141 .kmerge_by(|node1, node2| node1.text_range().len() < node2.text_range().len())
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index 8843f2835..66724919b 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -208,12 +208,12 @@ impl SourceToDefCtx<'_, '_> {
208 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { 208 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) {
209 let res: GenericDefId = match_ast! { 209 let res: GenericDefId = match_ast! {
210 match (container.value) { 210 match (container.value) {
211 ast::FnDef(it) => { self.fn_to_def(container.with_value(it))?.into() }, 211 ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(),
212 ast::StructDef(it) => { self.struct_to_def(container.with_value(it))?.into() }, 212 ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(),
213 ast::EnumDef(it) => { self.enum_to_def(container.with_value(it))?.into() }, 213 ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(),
214 ast::TraitDef(it) => { self.trait_to_def(container.with_value(it))?.into() }, 214 ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(),
215 ast::TypeAliasDef(it) => { self.type_alias_to_def(container.with_value(it))?.into() }, 215 ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(),
216 ast::ImplDef(it) => { self.impl_to_def(container.with_value(it))?.into() }, 216 ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(),
217 _ => continue, 217 _ => continue,
218 } 218 }
219 }; 219 };
@@ -226,9 +226,9 @@ impl SourceToDefCtx<'_, '_> {
226 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { 226 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) {
227 let res: DefWithBodyId = match_ast! { 227 let res: DefWithBodyId = match_ast! {
228 match (container.value) { 228 match (container.value) {
229 ast::ConstDef(it) => { self.const_to_def(container.with_value(it))?.into() }, 229 ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(),
230 ast::StaticDef(it) => { self.static_to_def(container.with_value(it))?.into() }, 230 ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(),
231 ast::FnDef(it) => { self.fn_to_def(container.with_value(it))?.into() }, 231 ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(),
232 _ => continue, 232 _ => continue,
233 } 233 }
234 }; 234 };