rust: use crossbeam-channel crate directly
authorSimon Sapin <simon-commits@exyr.org>
Mon, 30 Nov 2020 17:13:07 +0100
changeset 46054 fd47483f1645
parent 46053 aad81032a128
child 46055 7740d5102760
rust: use crossbeam-channel crate directly … instead of its reexport in the crossbeam crate. This removes two crates from the dependency graph. Differential Revision: https://phab.mercurial-scm.org/D9521
rust/Cargo.lock
rust/hg-core/Cargo.toml
rust/hg-core/src/dirstate/status.rs
rust/hg-core/src/operations/dirstate_status.rs
--- a/rust/Cargo.lock	Fri Dec 04 12:42:23 2020 +0100
+++ b/rust/Cargo.lock	Mon Nov 30 17:13:07 2020 +0100
@@ -101,19 +101,6 @@
 ]
 
 [[package]]
-name = "crossbeam"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
 name = "crossbeam-channel"
 version = "0.4.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -147,16 +134,6 @@
 ]
 
 [[package]]
-name = "crossbeam-queue"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
 name = "crossbeam-utils"
 version = "0.7.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -273,7 +250,7 @@
 dependencies = [
  "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "flate2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "im-rc 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -902,11 +879,9 @@
 "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
 "checksum cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaf3847ab963e40c4f6dd8d6be279bdf74007ae2413786a0dcbb28c52139a95"
 "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
-"checksum crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
 "checksum crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
 "checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
 "checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
-"checksum crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
 "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
 "checksum ctor 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
 "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
--- a/rust/hg-core/Cargo.toml	Fri Dec 04 12:42:23 2020 +0100
+++ b/rust/hg-core/Cargo.toml	Mon Nov 30 17:13:07 2020 +0100
@@ -21,7 +21,7 @@
 regex = "1.3.9"
 twox-hash = "1.5.0"
 same-file = "1.0.6"
-crossbeam = "0.7.3"
+crossbeam-channel = "0.4"
 micro-timer = "0.3.0"
 log = "0.4.8"
 memmap = "0.7.0"
--- a/rust/hg-core/src/dirstate/status.rs	Fri Dec 04 12:42:23 2020 +0100
+++ b/rust/hg-core/src/dirstate/status.rs	Mon Nov 30 17:13:07 2020 +0100
@@ -376,7 +376,7 @@
     #[timed]
     pub fn walk_explicit(
         &self,
-        traversed_sender: crossbeam::Sender<HgPathBuf>,
+        traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
     ) -> (Vec<DispatchedPath<'a>>, Vec<DispatchedPath<'a>>) {
         self.matcher
             .file_set()
@@ -474,13 +474,13 @@
         path: impl AsRef<HgPath>,
         old_results: &FastHashMap<HgPathCow<'a>, Dispatch>,
         results: &mut Vec<DispatchedPath<'a>>,
-        traversed_sender: crossbeam::Sender<HgPathBuf>,
+        traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
     ) {
         // The traversal is done in parallel, so use a channel to gather
-        // entries. `crossbeam::Sender` is `Sync`, while `mpsc::Sender`
+        // entries. `crossbeam_channel::Sender` is `Sync`, while `mpsc::Sender`
         // is not.
         let (files_transmitter, files_receiver) =
-            crossbeam::channel::unbounded();
+            crossbeam_channel::unbounded();
 
         self.traverse_dir(
             &files_transmitter,
@@ -506,11 +506,11 @@
     fn handle_traversed_entry<'b>(
         &'a self,
         scope: &rayon::Scope<'b>,
-        files_sender: &'b crossbeam::Sender<(HgPathBuf, Dispatch)>,
+        files_sender: &'b crossbeam_channel::Sender<(HgPathBuf, Dispatch)>,
         old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>,
         filename: HgPathBuf,
         dir_entry: DirEntry,
-        traversed_sender: crossbeam::Sender<HgPathBuf>,
+        traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
     ) -> IoResult<()>
     where
         'a: 'b,
@@ -592,11 +592,11 @@
     fn handle_traversed_dir<'b>(
         &'a self,
         scope: &rayon::Scope<'b>,
-        files_sender: &'b crossbeam::Sender<(HgPathBuf, Dispatch)>,
+        files_sender: &'b crossbeam_channel::Sender<(HgPathBuf, Dispatch)>,
         old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>,
         entry_option: Option<&'a DirstateEntry>,
         directory: HgPathBuf,
-        traversed_sender: crossbeam::Sender<HgPathBuf>,
+        traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
     ) where
         'a: 'b,
     {
@@ -631,10 +631,10 @@
     /// entries in a separate thread.
     fn traverse_dir(
         &self,
-        files_sender: &crossbeam::Sender<(HgPathBuf, Dispatch)>,
+        files_sender: &crossbeam_channel::Sender<(HgPathBuf, Dispatch)>,
         directory: impl AsRef<HgPath>,
         old_results: &FastHashMap<Cow<HgPath>, Dispatch>,
-        traversed_sender: crossbeam::Sender<HgPathBuf>,
+        traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
     ) {
         let directory = directory.as_ref();
 
--- a/rust/hg-core/src/operations/dirstate_status.rs	Fri Dec 04 12:42:23 2020 +0100
+++ b/rust/hg-core/src/operations/dirstate_status.rs	Mon Nov 30 17:13:07 2020 +0100
@@ -18,7 +18,7 @@
 impl<'a, M: Matcher + Sync> Status<'a, M> {
     pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> {
         let (traversed_sender, traversed_receiver) =
-            crossbeam::channel::unbounded();
+            crossbeam_channel::unbounded();
 
         // Step 1: check the files explicitly mentioned by the user
         let (work, mut results) = self.walk_explicit(traversed_sender.clone());
@@ -77,7 +77,7 @@
 impl<'a, M: Matcher + Sync> Status<'a, M> {
     pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> {
         let (traversed_sender, traversed_receiver) =
-            crossbeam::channel::unbounded();
+            crossbeam_channel::unbounded();
 
         // Step 1: check the files explicitly mentioned by the user
         let (work, mut results) = self.walk_explicit(traversed_sender.clone());