aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/from_source.rs2
-rw-r--r--crates/ra_hir_def/src/nameres.rs7
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs1
-rw-r--r--crates/ra_ide/src/references/rename.rs2
-rw-r--r--crates/ra_ide/src/references/search_scope.rs5
5 files changed, 3 insertions, 14 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 67b127ba5..a46bba4f2 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -257,7 +257,7 @@ impl Module {
257 InFile { file_id: src.file_id, value: module.clone() }, 257 InFile { file_id: src.file_id, value: module.clone() },
258 ); 258 );
259 } 259 }
260 ModuleSource::SourceFile(_) | ModuleSource::Block(_) => (), 260 ModuleSource::SourceFile(_) => (),
261 }; 261 };
262 262
263 let original_file = src.file_id.original_file(db); 263 let original_file = src.file_id.original_file(db);
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index ce318571c..f70235c99 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -109,7 +109,6 @@ pub enum ModuleOrigin {
109 /// Note that non-inline modules, by definition, live inside non-macro file. 109 /// Note that non-inline modules, by definition, live inside non-macro file.
110 File(AstId<ast::Module>, FileId), 110 File(AstId<ast::Module>, FileId),
111 Inline(AstId<ast::Module>), 111 Inline(AstId<ast::Module>),
112 Block(AstId<ast::Block>),
113} 112}
114 113
115impl Default for ModuleOrigin { 114impl Default for ModuleOrigin {
@@ -140,7 +139,7 @@ impl ModuleOrigin {
140 pub fn declaration(&self) -> Option<AstId<ast::Module>> { 139 pub fn declaration(&self) -> Option<AstId<ast::Module>> {
141 match self { 140 match self {
142 ModuleOrigin::File(m, _) | ModuleOrigin::Inline(m) => Some(*m), 141 ModuleOrigin::File(m, _) | ModuleOrigin::Inline(m) => Some(*m),
143 ModuleOrigin::Root(_) | ModuleOrigin::Block(_) => None, 142 ModuleOrigin::Root(_) => None,
144 } 143 }
145 } 144 }
146 145
@@ -162,7 +161,6 @@ impl ModuleOrigin {
162 } 161 }
163 ModuleOrigin::Root(None) => unreachable!(), 162 ModuleOrigin::Root(None) => unreachable!(),
164 ModuleOrigin::Inline(m) => InFile::new(m.file_id, ModuleSource::Module(m.to_node(db))), 163 ModuleOrigin::Inline(m) => InFile::new(m.file_id, ModuleSource::Module(m.to_node(db))),
165 ModuleOrigin::Block(b) => InFile::new(b.file_id, ModuleSource::Block(b.to_node(db))),
166 } 164 }
167 } 165 }
168} 166}
@@ -360,7 +358,6 @@ impl ModuleData {
360pub enum ModuleSource { 358pub enum ModuleSource {
361 SourceFile(ast::SourceFile), 359 SourceFile(ast::SourceFile),
362 Module(ast::Module), 360 Module(ast::Module),
363 Block(ast::Block),
364} 361}
365 362
366impl ModuleSource { 363impl ModuleSource {
@@ -384,8 +381,6 @@ impl ModuleSource {
384 child.value.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) 381 child.value.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi())
385 { 382 {
386 ModuleSource::Module(m) 383 ModuleSource::Module(m)
387 } else if let Some(b) = child.value.ancestors().filter_map(ast::Block::cast).next() {
388 ModuleSource::Block(b)
389 } else { 384 } else {
390 let file_id = child.file_id.original_file(db); 385 let file_id = child.file_id.original_file(db);
391 let source_file = db.parse(file_id).tree(); 386 let source_file = db.parse(file_id).tree();
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index b376fcdae..add11fbc3 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -234,7 +234,6 @@ impl ToNav for hir::Module {
234 let syntax = match &src.value { 234 let syntax = match &src.value {
235 ModuleSource::SourceFile(node) => node.syntax(), 235 ModuleSource::SourceFile(node) => node.syntax(),
236 ModuleSource::Module(node) => node.syntax(), 236 ModuleSource::Module(node) => node.syntax(),
237 ModuleSource::Block(node) => node.syntax(),
238 }; 237 };
239 let frange = original_range(db, src.with_value(syntax)); 238 let frange = original_range(db, src.with_value(syntax));
240 NavigationTarget::from_syntax( 239 NavigationTarget::from_syntax(
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 1abf20215..b804d5f6d 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -88,7 +88,7 @@ fn rename_mod(
88 file_system_edits.push(move_file); 88 file_system_edits.push(move_file);
89 } 89 }
90 } 90 }
91 ModuleSource::Module(..) | ModuleSource::Block(..) => {} 91 ModuleSource::Module(..) => {}
92 } 92 }
93 } 93 }
94 94
diff --git a/crates/ra_ide/src/references/search_scope.rs b/crates/ra_ide/src/references/search_scope.rs
index 92eb2015b..f5c9589f4 100644
--- a/crates/ra_ide/src/references/search_scope.rs
+++ b/crates/ra_ide/src/references/search_scope.rs
@@ -96,10 +96,6 @@ impl NameDefinition {
96 let range = Some(m.syntax().text_range()); 96 let range = Some(m.syntax().text_range());
97 res.insert(file_id, range); 97 res.insert(file_id, range);
98 } 98 }
99 ModuleSource::Block(b) => {
100 let range = Some(b.syntax().text_range());
101 res.insert(file_id, range);
102 }
103 ModuleSource::SourceFile(_) => { 99 ModuleSource::SourceFile(_) => {
104 res.insert(file_id, None); 100 res.insert(file_id, None);
105 res.extend(parent_module.children(db).map(|m| { 101 res.extend(parent_module.children(db).map(|m| {
@@ -141,7 +137,6 @@ impl NameDefinition {
141 let mut res = FxHashMap::default(); 137 let mut res = FxHashMap::default();
142 let range = match module_src.value { 138 let range = match module_src.value {
143 ModuleSource::Module(m) => Some(m.syntax().text_range()), 139 ModuleSource::Module(m) => Some(m.syntax().text_range()),
144 ModuleSource::Block(b) => Some(b.syntax().text_range()),
145 ModuleSource::SourceFile(_) => None, 140 ModuleSource::SourceFile(_) => None,
146 }; 141 };
147 res.insert(file_id, range); 142 res.insert(file_id, range);