From eb6cfa7f157690480fca5d55c69dba3fae87ad4f Mon Sep 17 00:00:00 2001 From: Chetan Khilosiya Date: Tue, 23 Feb 2021 00:44:58 +0530 Subject: [PATCH] 7526: Renamed create ssr to ide_ssr. --- Cargo.lock | 32 ++++++++++++------------ crates/ide/Cargo.toml | 2 +- crates/ide/src/lib.rs | 7 +++--- crates/{ssr => ide_ssr}/Cargo.toml | 2 +- crates/{ssr => ide_ssr}/src/errors.rs | 0 crates/{ssr => ide_ssr}/src/lib.rs | 0 crates/{ssr => ide_ssr}/src/matching.rs | 0 crates/{ssr => ide_ssr}/src/nester.rs | 0 crates/{ssr => ide_ssr}/src/parsing.rs | 0 crates/{ssr => ide_ssr}/src/replacing.rs | 0 crates/{ssr => ide_ssr}/src/resolving.rs | 0 crates/{ssr => ide_ssr}/src/search.rs | 0 crates/{ssr => ide_ssr}/src/tests.rs | 0 crates/rust-analyzer/Cargo.toml | 2 +- crates/rust-analyzer/src/bin/args.rs | 2 +- crates/rust-analyzer/src/cli/ssr.rs | 2 +- 16 files changed, 25 insertions(+), 24 deletions(-) rename crates/{ssr => ide_ssr}/Cargo.toml (97%) rename crates/{ssr => ide_ssr}/src/errors.rs (100%) rename crates/{ssr => ide_ssr}/src/lib.rs (100%) rename crates/{ssr => ide_ssr}/src/matching.rs (100%) rename crates/{ssr => ide_ssr}/src/nester.rs (100%) rename crates/{ssr => ide_ssr}/src/parsing.rs (100%) rename crates/{ssr => ide_ssr}/src/replacing.rs (100%) rename crates/{ssr => ide_ssr}/src/resolving.rs (100%) rename crates/{ssr => ide_ssr}/src/search.rs (100%) rename crates/{ssr => ide_ssr}/src/tests.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 477440f5fd..e101ce4af6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -592,6 +592,7 @@ dependencies = [ "ide_assists", "ide_completion", "ide_db", + "ide_ssr", "indexmap", "itertools 0.10.0", "log", @@ -600,7 +601,6 @@ dependencies = [ "pulldown-cmark", "pulldown-cmark-to-cmark", "rustc-hash", - "ssr", "stdx", "syntax", "test_utils", @@ -665,6 +665,20 @@ dependencies = [ "text_edit", ] +[[package]] +name = "ide_ssr" +version = "0.0.0" +dependencies = [ + "expect-test", + "hir", + "ide_db", + "itertools 0.10.0", + "rustc-hash", + "syntax", + "test_utils", + "text_edit", +] + [[package]] name = "idna" version = "0.2.2" @@ -1348,6 +1362,7 @@ dependencies = [ "hir_ty", "ide", "ide_db", + "ide_ssr", "itertools 0.10.0", "jemallocator", "jod-thread", @@ -1367,7 +1382,6 @@ dependencies = [ "serde", "serde_json", "serde_path_to_error", - "ssr", "stdx", "syntax", "test_utils", @@ -1572,20 +1586,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ssr" -version = "0.0.0" -dependencies = [ - "expect-test", - "hir", - "ide_db", - "itertools 0.10.0", - "rustc-hash", - "syntax", - "test_utils", - "text_edit", -] - [[package]] name = "stdx" version = "0.0.0" diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index b7152c8392..f6aaaeda45 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml @@ -28,7 +28,7 @@ cfg = { path = "../cfg", version = "0.0.0" } profile = { path = "../profile", version = "0.0.0" } test_utils = { path = "../test_utils", version = "0.0.0" } ide_assists = { path = "../ide_assists", version = "0.0.0" } -ssr = { path = "../ssr", version = "0.0.0" } +ide_ssr = { path = "../ide_ssr", version = "0.0.0" } ide_completion = { path = "../ide_completion", version = "0.0.0" } # ide should depend only on the top-level `hir` package. if you need diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index eb26d13b91..b600178ee1 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -101,7 +101,7 @@ pub use ide_db::{ symbol_index::Query, RootDatabase, }; -pub use ssr::SsrError; +pub use ide_ssr::SsrError; pub use syntax::{TextRange, TextSize}; pub use text_edit::{Indel, TextEdit}; @@ -549,8 +549,9 @@ impl Analysis { selections: Vec, ) -> Cancelable> { self.with_db(|db| { - let rule: ssr::SsrRule = query.parse()?; - let mut match_finder = ssr::MatchFinder::in_context(db, resolve_context, selections); + let rule: ide_ssr::SsrRule = query.parse()?; + let mut match_finder = + ide_ssr::MatchFinder::in_context(db, resolve_context, selections); match_finder.add_rule(rule)?; let edits = if parse_only { Default::default() } else { match_finder.edits() }; Ok(SourceChange::from(edits)) diff --git a/crates/ssr/Cargo.toml b/crates/ide_ssr/Cargo.toml similarity index 97% rename from crates/ssr/Cargo.toml rename to crates/ide_ssr/Cargo.toml index cc8136d223..edbc1846ba 100644 --- a/crates/ssr/Cargo.toml +++ b/crates/ide_ssr/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ssr" +name = "ide_ssr" version = "0.0.0" description = "Structural search and replace of Rust code" license = "MIT OR Apache-2.0" diff --git a/crates/ssr/src/errors.rs b/crates/ide_ssr/src/errors.rs similarity index 100% rename from crates/ssr/src/errors.rs rename to crates/ide_ssr/src/errors.rs diff --git a/crates/ssr/src/lib.rs b/crates/ide_ssr/src/lib.rs similarity index 100% rename from crates/ssr/src/lib.rs rename to crates/ide_ssr/src/lib.rs diff --git a/crates/ssr/src/matching.rs b/crates/ide_ssr/src/matching.rs similarity index 100% rename from crates/ssr/src/matching.rs rename to crates/ide_ssr/src/matching.rs diff --git a/crates/ssr/src/nester.rs b/crates/ide_ssr/src/nester.rs similarity index 100% rename from crates/ssr/src/nester.rs rename to crates/ide_ssr/src/nester.rs diff --git a/crates/ssr/src/parsing.rs b/crates/ide_ssr/src/parsing.rs similarity index 100% rename from crates/ssr/src/parsing.rs rename to crates/ide_ssr/src/parsing.rs diff --git a/crates/ssr/src/replacing.rs b/crates/ide_ssr/src/replacing.rs similarity index 100% rename from crates/ssr/src/replacing.rs rename to crates/ide_ssr/src/replacing.rs diff --git a/crates/ssr/src/resolving.rs b/crates/ide_ssr/src/resolving.rs similarity index 100% rename from crates/ssr/src/resolving.rs rename to crates/ide_ssr/src/resolving.rs diff --git a/crates/ssr/src/search.rs b/crates/ide_ssr/src/search.rs similarity index 100% rename from crates/ssr/src/search.rs rename to crates/ide_ssr/src/search.rs diff --git a/crates/ssr/src/tests.rs b/crates/ide_ssr/src/tests.rs similarity index 100% rename from crates/ssr/src/tests.rs rename to crates/ide_ssr/src/tests.rs diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 2a5cd59f9a..b881cc229b 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -53,7 +53,7 @@ cfg = { path = "../cfg", version = "0.0.0" } toolchain = { path = "../toolchain", version = "0.0.0" } # This should only be used in CLI -ssr = { path = "../ssr", version = "0.0.0" } +ide_ssr = { path = "../ide_ssr", version = "0.0.0" } hir = { path = "../hir", version = "0.0.0" } hir_def = { path = "../hir_def", version = "0.0.0" } hir_ty = { path = "../hir_ty", version = "0.0.0" } diff --git a/crates/rust-analyzer/src/bin/args.rs b/crates/rust-analyzer/src/bin/args.rs index 3a7db6a18a..164d94a304 100644 --- a/crates/rust-analyzer/src/bin/args.rs +++ b/crates/rust-analyzer/src/bin/args.rs @@ -6,9 +6,9 @@ use std::{env, path::PathBuf}; use anyhow::{bail, format_err, Result}; +use ide_ssr::{SsrPattern, SsrRule}; use pico_args::Arguments; use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity}; -use ssr::{SsrPattern, SsrRule}; use vfs::AbsPathBuf; pub(crate) struct Args { diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs index 71c61ed58a..71a8f8fb9e 100644 --- a/crates/rust-analyzer/src/cli/ssr.rs +++ b/crates/rust-analyzer/src/cli/ssr.rs @@ -4,7 +4,7 @@ use crate::cli::{ load_cargo::{load_workspace_at, LoadCargoConfig}, Result, }; -use ssr::{MatchFinder, SsrPattern, SsrRule}; +use ide_ssr::{MatchFinder, SsrPattern, SsrRule}; pub fn apply_ssr_rules(rules: Vec) -> Result<()> { use ide_db::base_db::SourceDatabaseExt;