internal: flatten module hierarchy

It seems that any crate can be made better by flattening the modules
down to a single layer?
This commit is contained in:
Aleksey Kladov 2021-06-14 19:14:34 +03:00
parent 9fb67e7477
commit da534bdd07
3 changed files with 10 additions and 9 deletions

View File

@ -39,6 +39,7 @@ macro_rules! eprintln {
mod move_item;
mod parent_module;
mod references;
mod rename;
mod fn_references;
mod runnables;
mod ssr;
@ -79,7 +80,8 @@ macro_rules! eprintln {
markup::Markup,
move_item::Direction,
prime_caches::PrimeCachesProgress,
references::{rename::RenameError, ReferenceSearchResult},
references::ReferenceSearchResult,
rename::RenameError,
runnables::{Runnable, RunnableKind, TestId},
syntax_highlighting::{
tags::{Highlight, HlMod, HlMods, HlOperator, HlPunct, HlTag},
@ -591,14 +593,14 @@ pub fn rename(
position: FilePosition,
new_name: &str,
) -> Cancellable<Result<SourceChange, RenameError>> {
self.with_db(|db| references::rename::rename(db, position, new_name))
self.with_db(|db| rename::rename(db, position, new_name))
}
pub fn prepare_rename(
&self,
position: FilePosition,
) -> Cancellable<Result<RangeInfo<()>, RenameError>> {
self.with_db(|db| references::rename::prepare_rename(db, position))
self.with_db(|db| rename::prepare_rename(db, position))
}
pub fn will_rename_file(
@ -606,7 +608,7 @@ pub fn will_rename_file(
file_id: FileId,
new_name_stem: &str,
) -> Cancellable<Option<SourceChange>> {
self.with_db(|db| references::rename::will_rename_file(db, file_id, new_name_stem))
self.with_db(|db| rename::will_rename_file(db, file_id, new_name_stem))
}
pub fn structural_search_replace(

View File

@ -9,8 +9,6 @@
//! at the index that the match starts at and its tree parent is
//! resolved to the search element definition, we get a reference.
pub(crate) mod rename;
use hir::{PathResolution, Semantics};
use ide_db::{
base_db::FileId,

View File

@ -1,7 +1,8 @@
//! Renaming functionality
//! Renaming functionality.
//!
//! All reference and file rename requests go through here where the corresponding [`SourceChange`]s
//! will be calculated.
//! This is mostly front-end for [`ide_db::rename`], but it also includes the
//! tests. This module also implements a couple of magic tricks, like renaming
//! `self` and to `self` (to switch between associated function and method).
use hir::{AsAssocItem, InFile, Semantics};
use ide_db::{
base_db::FileId,