aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-06-14 17:14:34 +0100
committerAleksey Kladov <[email protected]>2021-06-14 17:14:34 +0100
commitda534bdd074788e47b5dae76998b8f8535ea7257 (patch)
tree9ad4abadebbc7ae942e43355735a657bd4bca430 /crates/ide
parent9fb67e7477a43fc91946f17c00205b7e31db00d8 (diff)
internal: flatten module hierarchy
It seems that any crate can be made better by flattening the modules down to a single layer?
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/lib.rs10
-rw-r--r--crates/ide/src/references.rs2
-rw-r--r--crates/ide/src/rename.rs (renamed from crates/ide/src/references/rename.rs)7
3 files changed, 10 insertions, 9 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 98d01f0ce..9db387d26 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -39,6 +39,7 @@ mod matching_brace;
39mod move_item; 39mod move_item;
40mod parent_module; 40mod parent_module;
41mod references; 41mod references;
42mod rename;
42mod fn_references; 43mod fn_references;
43mod runnables; 44mod runnables;
44mod ssr; 45mod ssr;
@@ -79,7 +80,8 @@ pub use crate::{
79 markup::Markup, 80 markup::Markup,
80 move_item::Direction, 81 move_item::Direction,
81 prime_caches::PrimeCachesProgress, 82 prime_caches::PrimeCachesProgress,
82 references::{rename::RenameError, ReferenceSearchResult}, 83 references::ReferenceSearchResult,
84 rename::RenameError,
83 runnables::{Runnable, RunnableKind, TestId}, 85 runnables::{Runnable, RunnableKind, TestId},
84 syntax_highlighting::{ 86 syntax_highlighting::{
85 tags::{Highlight, HlMod, HlMods, HlOperator, HlPunct, HlTag}, 87 tags::{Highlight, HlMod, HlMods, HlOperator, HlPunct, HlTag},
@@ -591,14 +593,14 @@ impl Analysis {
591 position: FilePosition, 593 position: FilePosition,
592 new_name: &str, 594 new_name: &str,
593 ) -> Cancellable<Result<SourceChange, RenameError>> { 595 ) -> Cancellable<Result<SourceChange, RenameError>> {
594 self.with_db(|db| references::rename::rename(db, position, new_name)) 596 self.with_db(|db| rename::rename(db, position, new_name))
595 } 597 }
596 598
597 pub fn prepare_rename( 599 pub fn prepare_rename(
598 &self, 600 &self,
599 position: FilePosition, 601 position: FilePosition,
600 ) -> Cancellable<Result<RangeInfo<()>, RenameError>> { 602 ) -> Cancellable<Result<RangeInfo<()>, RenameError>> {
601 self.with_db(|db| references::rename::prepare_rename(db, position)) 603 self.with_db(|db| rename::prepare_rename(db, position))
602 } 604 }
603 605
604 pub fn will_rename_file( 606 pub fn will_rename_file(
@@ -606,7 +608,7 @@ impl Analysis {
606 file_id: FileId, 608 file_id: FileId,
607 new_name_stem: &str, 609 new_name_stem: &str,
608 ) -> Cancellable<Option<SourceChange>> { 610 ) -> Cancellable<Option<SourceChange>> {
609 self.with_db(|db| references::rename::will_rename_file(db, file_id, new_name_stem)) 611 self.with_db(|db| rename::will_rename_file(db, file_id, new_name_stem))
610 } 612 }
611 613
612 pub fn structural_search_replace( 614 pub fn structural_search_replace(
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index a0fdead2c..945c9b9e1 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -9,8 +9,6 @@
9//! at the index that the match starts at and its tree parent is 9//! at the index that the match starts at and its tree parent is
10//! resolved to the search element definition, we get a reference. 10//! resolved to the search element definition, we get a reference.
11 11
12pub(crate) mod rename;
13
14use hir::{PathResolution, Semantics}; 12use hir::{PathResolution, Semantics};
15use ide_db::{ 13use ide_db::{
16 base_db::FileId, 14 base_db::FileId,
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/rename.rs
index cec1d4552..41689a939 100644
--- a/crates/ide/src/references/rename.rs
+++ b/crates/ide/src/rename.rs
@@ -1,7 +1,8 @@
1//! Renaming functionality 1//! Renaming functionality.
2//! 2//!
3//! All reference and file rename requests go through here where the corresponding [`SourceChange`]s 3//! This is mostly front-end for [`ide_db::rename`], but it also includes the
4//! will be calculated. 4//! tests. This module also implements a couple of magic tricks, like renaming
5//! `self` and to `self` (to switch between associated function and method).
5use hir::{AsAssocItem, InFile, Semantics}; 6use hir::{AsAssocItem, InFile, Semantics};
6use ide_db::{ 7use ide_db::{
7 base_db::FileId, 8 base_db::FileId,