summaryrefslogtreecommitdiff
path: root/games-rpg/rpg-cli/files/rpg-cli-1.0.0-into_values.patch
blob: 9130df5c42be740e22abe2ac57c856931742a336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Fix build with <rust-1.54

error[E0658]: use of unstable library feature 'map_into_keys_values'
   --> src/item/chest.rs:111:51
    |
111 |         let mut items: Vec<Box<dyn Item>> = items.into_values().flatten().collect();
    |                                                   ^^^^^^^^^^^
    |
    = note: see issue #75294 <https://github.com/rust-lang/rust/issues/75294> for more information

--- a/src/item/chest.rs
+++ b/src/item/chest.rs
@@ -108,7 +108,7 @@ impl Chest {
     /// Remove the gold, items and equipment from a hero and return them as a new chest.
     pub fn drop(game: &mut game::Game) -> Self {
         let items: HashMap<Key, Vec<Box<dyn Item>>> = game.inventory.drain().collect();
-        let mut items: Vec<Box<dyn Item>> = items.into_values().flatten().collect();
+        let mut items: Vec<Box<dyn Item>> = items.into_iter().map(|(_, v)| v).flatten().collect();
         let sword = game.player.sword.take();
         let shield = game.player.shield.take();