about summary refs log tree commit diff
path: root/library/std/src/collections/hash
diff options
context:
space:
mode:
authorAlexis Bourget <alexis.bourget@gmail.com>2020-08-30 21:59:43 +0200
committerAlexis Bourget <alexis.bourget@gmail.com>2020-08-30 21:59:43 +0200
commit81e85ce76d6630a8f87f81df2470e76fbe73de7d (patch)
tree55988a948bd8b9f80aba09c8a6e9ef8d13eaf6e1 /library/std/src/collections/hash
parent85fbf49ce0e2274d0acf798f6e703747674feec3 (diff)
downloadrust-81e85ce76d6630a8f87f81df2470e76fbe73de7d.tar.gz
rust-81e85ce76d6630a8f87f81df2470e76fbe73de7d.zip
Move to Arc::clone(&x) over x.clone() in library/std
Diffstat (limited to 'library/std/src/collections/hash')
-rw-r--r--library/std/src/collections/hash/map.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs
index 70f7214e2f1..56f63002b7f 100644
--- a/library/std/src/collections/hash/map.rs
+++ b/library/std/src/collections/hash/map.rs
@@ -2381,7 +2381,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
     /// use std::rc::Rc;
     ///
     /// let mut map: HashMap<Rc<String>, u32> = HashMap::new();
-    /// let mut known_strings: Vec<Rc<String>> = Vec::new();
+    /// let known_strings: Vec<Rc<String>> = Vec::new();
     ///
     /// // Initialise known strings, run program, etc.
     ///
@@ -2389,7 +2389,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
     ///
     /// fn reclaim_memory(map: &mut HashMap<Rc<String>, u32>, known_strings: &[Rc<String>] ) {
     ///     for s in known_strings {
-    ///         if let Entry::Occupied(entry) = map.entry(s.clone()) {
+    ///         if let Entry::Occupied(entry) = map.entry(Rc::clone(s)) {
     ///             // Replaces the entry's key with our version of it in `known_strings`.
     ///             entry.replace_key();
     ///         }