@@ -2341,14 +2341,14 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
2341
2341
/// use std::collections::hash_map::{Entry, HashMap};
2342
2342
/// use std::rc::Rc;
2343
2343
///
2344
- /// let mut map: HashMap<Rc<String >, u32> = HashMap::new();
2345
- /// map.insert(Rc::new( "Stringthing".to_string() ), 15);
2344
+ /// let mut map: HashMap<Rc<str >, u32> = HashMap::new();
2345
+ /// map.insert("Stringthing".into( ), 15);
2346
2346
///
2347
- /// let my_key = Rc::new( "Stringthing".to_string() );
2347
+ /// let my_key: Rc<str> = "Stringthing".into( );
2348
2348
///
2349
2349
/// if let Entry::Occupied(entry) = map.entry(my_key) {
2350
2350
/// // Also replace the key with a handle to our other key.
2351
- /// let (old_key, old_value): (Rc<String >, u32) = entry.replace_entry(16);
2351
+ /// let (old_key, old_value): (Rc<str >, u32) = entry.replace_entry(16);
2352
2352
/// }
2353
2353
///
2354
2354
/// ```
@@ -2371,14 +2371,14 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
2371
2371
/// use std::collections::hash_map::{Entry, HashMap};
2372
2372
/// use std::rc::Rc;
2373
2373
///
2374
- /// let mut map: HashMap<Rc<String >, u32> = HashMap::new();
2375
- /// let mut known_strings: Vec<Rc<String >> = Vec::new();
2374
+ /// let mut map: HashMap<Rc<str >, u32> = HashMap::new();
2375
+ /// let mut known_strings: Vec<Rc<str >> = Vec::new();
2376
2376
///
2377
2377
/// // Initialise known strings, run program, etc.
2378
2378
///
2379
2379
/// reclaim_memory(&mut map, &known_strings);
2380
2380
///
2381
- /// fn reclaim_memory(map: &mut HashMap<Rc<String >, u32>, known_strings: &[Rc<String >] ) {
2381
+ /// fn reclaim_memory(map: &mut HashMap<Rc<str >, u32>, known_strings: &[Rc<str >] ) {
2382
2382
/// for s in known_strings {
2383
2383
/// if let Entry::Occupied(entry) = map.entry(s.clone()) {
2384
2384
/// // Replaces the entry's key with our version of it in `known_strings`.
0 commit comments