diff rust/hg-core/examples/nodemap/main.rs @ 49987:58074252db3c

rust: run `cargo clippy` These automatic fixes are good to have because they make the code more idiomatic and less surprising. The transform from `sort` -> `sort_unstable` is questionable, but this is only in a test, so it doesn't matter in our case.
author Rapha?l Gom?s <rgomes@octobus.net>
date Mon, 09 Jan 2023 17:40:03 +0100
parents 14bfd22a57a9
children 0d301f4180f5
line wrap: on
line diff
--- a/rust/hg-core/examples/nodemap/main.rs	Fri Jan 06 18:52:04 2023 +0100
+++ b/rust/hg-core/examples/nodemap/main.rs	Mon Jan 09 17:40:03 2023 +0100
@@ -55,12 +55,7 @@
     let len = index.len() as u32;
     let mut rng = rand::thread_rng();
     let nodes: Vec<Node> = (0..queries)
-        .map(|_| {
-            index
-                .node((rng.gen::<u32>() % len) as Revision)
-                .unwrap()
-                .clone()
-        })
+        .map(|_| *index.node((rng.gen::<u32>() % len) as Revision).unwrap())
         .collect();
     if queries < 10 {
         let nodes_hex: Vec<String> =
@@ -125,7 +120,7 @@
                 nm_path.display(),
                 repo.display()
             );
-            create(&index, &Path::new(nm_path)).unwrap();
+            create(&index, Path::new(nm_path)).unwrap();
         }
         Command::Bench { queries } => {
             println!(