diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index abfaffb5e..74c12a0a2 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -11,6 +11,7 @@ use ra_syntax::{ | |||
11 | ast::{self, AstNode}, | 11 | ast::{self, AstNode}, |
12 | SyntaxKind::*, | 12 | SyntaxKind::*, |
13 | }; | 13 | }; |
14 | use rustc_hash::FxHashSet; | ||
14 | use test_utils::covers; | 15 | use test_utils::covers; |
15 | 16 | ||
16 | use crate::{ | 17 | use crate::{ |
@@ -2518,7 +2519,6 @@ fn test() { | |||
2518 | [167; 179) 'GLOBAL_CONST': u32 | 2519 | [167; 179) 'GLOBAL_CONST': u32 |
2519 | [189; 191) 'id': u32 | 2520 | [189; 191) 'id': u32 |
2520 | [194; 210) 'Foo::A..._CONST': u32 | 2521 | [194; 210) 'Foo::A..._CONST': u32 |
2521 | [126; 128) '99': u32 | ||
2522 | "### | 2522 | "### |
2523 | ); | 2523 | ); |
2524 | } | 2524 | } |
@@ -4742,10 +4742,13 @@ fn infer(content: &str) -> String { | |||
4742 | } | 4742 | } |
4743 | }; | 4743 | }; |
4744 | 4744 | ||
4745 | let mut analyzed = FxHashSet::default(); | ||
4745 | for node in source_file.syntax().descendants() { | 4746 | for node in source_file.syntax().descendants() { |
4746 | if node.kind() == FN_DEF || node.kind() == CONST_DEF || node.kind() == STATIC_DEF { | 4747 | if node.kind() == FN_DEF || node.kind() == CONST_DEF || node.kind() == STATIC_DEF { |
4747 | let analyzer = SourceAnalyzer::new(&db, Source::new(file_id.into(), &node), None); | 4748 | let analyzer = SourceAnalyzer::new(&db, Source::new(file_id.into(), &node), None); |
4748 | infer_def(analyzer.inference_result(), analyzer.body_source_map()); | 4749 | if analyzed.insert(analyzer.analyzed_declaration()) { |
4750 | infer_def(analyzer.inference_result(), analyzer.body_source_map()); | ||
4751 | } | ||
4749 | } | 4752 | } |
4750 | } | 4753 | } |
4751 | 4754 | ||