aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-20 15:45:22 +0000
committerGitHub <[email protected]>2019-11-20 15:45:22 +0000
commitc51dcb1c4bdd71f9f17de508bd0d47e3c06ae1d5 (patch)
tree7e96d773620a3b03254d00386711cdc7c909e3ee /crates/ra_hir/src/ty/tests.rs
parentb7a36b54431ca5b746af53549a1b6e142570c7f4 (diff)
parent111891dc2dc1d2c7ea87144e8e3ddefe23fc7b6d (diff)
Merge #2327
2327: Move constants to new ID r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs7
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};
14use rustc_hash::FxHashSet;
14use test_utils::covers; 15use test_utils::covers;
15 16
16use crate::{ 17use 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