about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/base-db/src/change.rs6
-rw-r--r--crates/base-db/src/lib.rs6
-rw-r--r--crates/hir-def/src/nameres/tests/incremental.rs5
-rw-r--r--crates/hir-expand/src/change.rs2
-rw-r--r--crates/hir-ty/src/tests.rs2
-rw-r--r--crates/hir-ty/src/tests/incremental.rs5
-rw-r--r--crates/ide/src/lib.rs2
-rw-r--r--crates/load-cargo/src/lib.rs4
-rw-r--r--crates/rust-analyzer/src/cli/rustc_tests.rs2
-rw-r--r--crates/rust-analyzer/src/global_state.rs2
-rw-r--r--crates/rust-analyzer/src/integrated_benchmarks.rs9
11 files changed, 21 insertions, 24 deletions
diff --git a/crates/base-db/src/change.rs b/crates/base-db/src/change.rs
index d709fde3315..335c7840a62 100644
--- a/crates/base-db/src/change.rs
+++ b/crates/base-db/src/change.rs
@@ -13,7 +13,7 @@ use crate::{CrateGraph, SourceDatabaseExt, SourceDatabaseExt2, SourceRoot, Sourc
 #[derive(Default)]
 pub struct FileChange {
     pub roots: Option<Vec<SourceRoot>>,
-    pub files_changed: Vec<(FileId, Option<Arc<str>>)>,
+    pub files_changed: Vec<(FileId, Option<String>)>,
     pub crate_graph: Option<CrateGraph>,
 }
 
@@ -42,7 +42,7 @@ impl FileChange {
         self.roots = Some(roots);
     }
 
-    pub fn change_file(&mut self, file_id: FileId, new_text: Option<Arc<str>>) {
+    pub fn change_file(&mut self, file_id: FileId, new_text: Option<String>) {
         self.files_changed.push((file_id, new_text))
     }
 
@@ -68,7 +68,7 @@ impl FileChange {
             let source_root = db.source_root(source_root_id);
             let durability = durability(&source_root);
             // XXX: can't actually remove the file, just reset the text
-            let text = text.unwrap_or_else(|| Arc::from(""));
+            let text = text.as_ref().map(String::as_str).unwrap_or_else(|| "");
             db.set_file_text_with_durability(file_id, text, durability)
         }
         if let Some(crate_graph) = self.crate_graph {
diff --git a/crates/base-db/src/lib.rs b/crates/base-db/src/lib.rs
index 2d3609888ba..69cd0eb3344 100644
--- a/crates/base-db/src/lib.rs
+++ b/crates/base-db/src/lib.rs
@@ -115,14 +115,14 @@ fn file_text(db: &dyn SourceDatabaseExt, file_id: FileId) -> Arc<str> {
 }
 
 pub trait SourceDatabaseExt2 {
-    fn set_file_text(&mut self, file_id: FileId, text: Arc<str>) {
+    fn set_file_text(&mut self, file_id: FileId, text: &str) {
         self.set_file_text_with_durability(file_id, text, Durability::LOW);
     }
 
     fn set_file_text_with_durability(
         &mut self,
         file_id: FileId,
-        text: Arc<str>,
+        text: &str,
         durability: Durability,
     );
 }
@@ -131,7 +131,7 @@ impl<Db: ?Sized + SourceDatabaseExt> SourceDatabaseExt2 for Db {
     fn set_file_text_with_durability(
         &mut self,
         file_id: FileId,
-        text: Arc<str>,
+        text: &str,
         durability: Durability,
     ) {
         let bytes = text.as_bytes();
diff --git a/crates/hir-def/src/nameres/tests/incremental.rs b/crates/hir-def/src/nameres/tests/incremental.rs
index 189c7b92613..be41634eb57 100644
--- a/crates/hir-def/src/nameres/tests/incremental.rs
+++ b/crates/hir-def/src/nameres/tests/incremental.rs
@@ -1,6 +1,5 @@
 use base_db::{SourceDatabase, SourceDatabaseExt2 as _};
 use test_fixture::WithFixture;
-use triomphe::Arc;
 
 use crate::{db::DefDatabase, nameres::tests::TestDB, AdtId, ModuleDefId};
 
@@ -17,7 +16,7 @@ fn check_def_map_is_not_recomputed(ra_fixture_initial: &str, ra_fixture_change:
         });
         assert!(format!("{events:?}").contains("crate_def_map"), "{events:#?}")
     }
-    db.set_file_text(pos.file_id, Arc::from(ra_fixture_change));
+    db.set_file_text(pos.file_id, ra_fixture_change);
 
     {
         let events = db.log_executed(|| {
@@ -267,7 +266,7 @@ fn quux() { 92 }
 m!(Y);
 m!(Z);
 "#;
-    db.set_file_text(pos.file_id, Arc::from(new_text));
+    db.set_file_text(pos.file_id, new_text);
 
     {
         let events = db.log_executed(|| {
diff --git a/crates/hir-expand/src/change.rs b/crates/hir-expand/src/change.rs
index 8b9e5a59df8..1a3dd0e7ddb 100644
--- a/crates/hir-expand/src/change.rs
+++ b/crates/hir-expand/src/change.rs
@@ -48,7 +48,7 @@ impl ChangeWithProcMacros {
         }
     }
 
-    pub fn change_file(&mut self, file_id: FileId, new_text: Option<Arc<str>>) {
+    pub fn change_file(&mut self, file_id: FileId, new_text: Option<String>) {
         self.source_change.change_file(file_id, new_text)
     }
 
diff --git a/crates/hir-ty/src/tests.rs b/crates/hir-ty/src/tests.rs
index 349da8feb26..c2d60f14a6b 100644
--- a/crates/hir-ty/src/tests.rs
+++ b/crates/hir-ty/src/tests.rs
@@ -575,7 +575,7 @@ fn salsa_bug() {
         }
     ";
 
-    db.set_file_text(pos.file_id, Arc::from(new_text));
+    db.set_file_text(pos.file_id, new_text);
 
     let module = db.module_for_file(pos.file_id);
     let crate_def_map = module.def_map(&db);
diff --git a/crates/hir-ty/src/tests/incremental.rs b/crates/hir-ty/src/tests/incremental.rs
index a3128336e7a..6066ec69c9a 100644
--- a/crates/hir-ty/src/tests/incremental.rs
+++ b/crates/hir-ty/src/tests/incremental.rs
@@ -1,6 +1,5 @@
 use base_db::SourceDatabaseExt2 as _;
 use test_fixture::WithFixture;
-use triomphe::Arc;
 
 use crate::{db::HirDatabase, test_db::TestDB};
 
@@ -33,7 +32,7 @@ fn foo() -> i32 {
     1
 }";
 
-    db.set_file_text(pos.file_id, Arc::from(new_text));
+    db.set_file_text(pos.file_id, new_text);
 
     {
         let events = db.log_executed(|| {
@@ -85,7 +84,7 @@ fn baz() -> i32 {
 }
 ";
 
-    db.set_file_text(pos.file_id, Arc::from(new_text));
+    db.set_file_text(pos.file_id, new_text);
 
     {
         let events = db.log_executed(|| {
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 59a7df14fd5..6955e14a10a 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -259,7 +259,7 @@ impl Analysis {
             false,
             CrateOrigin::Local { repo: None, name: None },
         );
-        change.change_file(file_id, Some(Arc::from(text)));
+        change.change_file(file_id, Some(text));
         change.set_crate_graph(crate_graph);
         change.set_target_data_layouts(vec![Err("fixture has no layout".into())]);
         change.set_toolchains(vec![None]);
diff --git a/crates/load-cargo/src/lib.rs b/crates/load-cargo/src/lib.rs
index a1c089520da..ffdba86c16b 100644
--- a/crates/load-cargo/src/lib.rs
+++ b/crates/load-cargo/src/lib.rs
@@ -361,8 +361,8 @@ fn load_crate_graph(
     let changes = vfs.take_changes();
     for file in changes {
         if let vfs::Change::Create(v) | vfs::Change::Modify(v) = file.change {
-            if let Ok(text) = std::str::from_utf8(&v) {
-                analysis_change.change_file(file.file_id, Some(text.into()))
+            if let Ok(text) = String::from_utf8(v) {
+                analysis_change.change_file(file.file_id, Some(text))
             }
         }
     }
diff --git a/crates/rust-analyzer/src/cli/rustc_tests.rs b/crates/rust-analyzer/src/cli/rustc_tests.rs
index 7ad87ab97fc..84f2e600874 100644
--- a/crates/rust-analyzer/src/cli/rustc_tests.rs
+++ b/crates/rust-analyzer/src/cli/rustc_tests.rs
@@ -134,7 +134,7 @@ impl Tester {
         let should_have_no_error = text.contains("// check-pass")
             || text.contains("// build-pass")
             || text.contains("// run-pass");
-        change.change_file(self.root_file, Some(Arc::from(text)));
+        change.change_file(self.root_file, Some(text));
         self.host.apply_change(change);
         let diagnostic_config = DiagnosticsConfig::test_sample();
 
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 0e560e54eda..1b4c33d8586 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -330,7 +330,7 @@ impl GlobalState {
                         // FIXME: Consider doing normalization in the `vfs` instead? That allows
                         // getting rid of some locking
                         let (text, line_endings) = LineEndings::normalize(text);
-                        (Arc::from(text), line_endings)
+                        (text, line_endings)
                     })
                 } else {
                     None
diff --git a/crates/rust-analyzer/src/integrated_benchmarks.rs b/crates/rust-analyzer/src/integrated_benchmarks.rs
index 3bba4847f92..19181885022 100644
--- a/crates/rust-analyzer/src/integrated_benchmarks.rs
+++ b/crates/rust-analyzer/src/integrated_benchmarks.rs
@@ -20,7 +20,6 @@ use ide_db::{
 };
 use project_model::CargoConfig;
 use test_utils::project_root;
-use triomphe::Arc;
 use vfs::{AbsPathBuf, VfsPath};
 
 use load_cargo::{load_workspace_at, LoadCargoConfig, ProcMacroServerChoice};
@@ -70,7 +69,7 @@ fn integrated_highlighting_benchmark() {
         let mut text = host.analysis().file_text(file_id).unwrap().to_string();
         text.push_str("\npub fn _dummy() {}\n");
         let mut change = ChangeWithProcMacros::new();
-        change.change_file(file_id, Some(Arc::from(text)));
+        change.change_file(file_id, Some(text));
         host.apply_change(change);
     }
 
@@ -125,7 +124,7 @@ fn integrated_completion_benchmark() {
             patch(&mut text, "db.struct_data(self.id)", "sel;\ndb.struct_data(self.id)")
                 + "sel".len();
         let mut change = ChangeWithProcMacros::new();
-        change.change_file(file_id, Some(Arc::from(text)));
+        change.change_file(file_id, Some(text));
         host.apply_change(change);
         completion_offset
     };
@@ -168,7 +167,7 @@ fn integrated_completion_benchmark() {
             patch(&mut text, "sel;\ndb.struct_data(self.id)", ";sel;\ndb.struct_data(self.id)")
                 + ";sel".len();
         let mut change = ChangeWithProcMacros::new();
-        change.change_file(file_id, Some(Arc::from(text)));
+        change.change_file(file_id, Some(text));
         host.apply_change(change);
         completion_offset
     };
@@ -210,7 +209,7 @@ fn integrated_completion_benchmark() {
             patch(&mut text, "sel;\ndb.struct_data(self.id)", "self.;\ndb.struct_data(self.id)")
                 + "self.".len();
         let mut change = ChangeWithProcMacros::new();
-        change.change_file(file_id, Some(Arc::from(text)));
+        change.change_file(file_id, Some(text));
         host.apply_change(change);
         completion_offset
     };