Updated hashbrown, removed some to_owned calls in handling recently unequipped items

This commit is contained in:
Sam 2023-04-16 19:39:02 -04:00
parent 63bf8f3ac7
commit e819cd2309
17 changed files with 42 additions and 29 deletions

33
Cargo.lock generated
View File

@ -2685,6 +2685,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash 0.7.6",
]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.0",
"rayon",
"serde",
]
@ -6651,7 +6660,7 @@ dependencies = [
"authc",
"byteorder",
"clap 3.2.22",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"image",
"num 0.4.0",
"quinn",
@ -6686,7 +6695,7 @@ dependencies = [
"fluent",
"fluent-bundle",
"fluent-syntax",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"intl-memoizer",
"ron 0.8.0",
"serde",
@ -6713,7 +6722,7 @@ dependencies = [
"dot_vox",
"enum-map",
"fxhash",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"indexmap",
"itertools",
"kiddo 0.1.7",
@ -6808,7 +6817,7 @@ version = "0.10.0"
dependencies = [
"bincode",
"flate2",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"image",
"num-traits",
"serde",
@ -6824,7 +6833,7 @@ name = "veloren-common-state"
version = "0.10.0"
dependencies = [
"bincode",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"num_cpus",
"rayon",
"scopeguard",
@ -6847,7 +6856,7 @@ dependencies = [
name = "veloren-common-systems"
version = "0.10.0"
dependencies = [
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"indexmap",
"itertools",
"ordered-float 3.1.0",
@ -6878,7 +6887,7 @@ dependencies = [
"crossbeam-channel",
"futures-core",
"futures-util",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"lazy_static",
"lz-fear",
"prometheus",
@ -6906,7 +6915,7 @@ dependencies = [
"bitflags",
"bytes",
"criterion",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"prometheus",
"rand 0.8.5",
"tokio",
@ -6949,7 +6958,7 @@ dependencies = [
"atomic_refcell",
"enum-map",
"fxhash",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"itertools",
"rand 0.8.5",
"rand_chacha 0.3.1",
@ -6979,7 +6988,7 @@ dependencies = [
"enum-map",
"enumset",
"futures-util",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"humantime",
"itertools",
"lazy_static",
@ -7095,7 +7104,7 @@ dependencies = [
"gilrs",
"glyph_brush",
"guillotiere",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"iced_native",
"iced_winit",
"image",
@ -7195,7 +7204,7 @@ dependencies = [
"fallible-iterator",
"flate2",
"fxhash",
"hashbrown 0.12.3",
"hashbrown 0.13.2",
"image",
"inline_tweak",
"itertools",

View File

@ -30,7 +30,7 @@ tracing = { version = "0.1", default-features = false }
rayon = "1.5"
specs = { version = "0.18", features = ["serde", "storage-event-control", "derive"] }
vek = { version = "0.15.8", features = ["serde"] }
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" }
#TODO: put bot in a different crate

View File

@ -17,7 +17,7 @@ intl-memoizer = { git = "https://github.com/juliancoffee/fluent-rs.git", branch
fluent = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"}
fluent-bundle = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"}
# Utility
hashbrown = { version = "0.12", features = ["serde", "nightly"] }
hashbrown = { version = "0.13", features = ["serde", "nightly"] }
deunicode = "1.0"
tracing = "0.1"
# Bin

View File

@ -74,7 +74,7 @@ petgraph = { version = "0.6", optional = true }
kiddo = { version = "0.1", optional = true }
# Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
slotmap = { version = "1.0", features = ["serde"] }
indexmap = { version = "1.3.0", features = ["rayon"] }
slab = "0.4.2"

View File

@ -22,7 +22,7 @@ vek = { version = "0.15.8", features = ["serde"] }
tracing = { version = "0.1", default-features = false }
# Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
# ECS
specs = { version = "0.18", features = ["serde", "storage-event-control"] }

View File

@ -20,6 +20,7 @@ use core::{
num::{NonZeroU32, NonZeroU64},
};
use crossbeam_utils::atomic::AtomicCell;
use hashbrown::Equivalent;
use serde::{de, Deserialize, Serialize, Serializer};
use specs::{Component, DenseVecStorage, DerefFlaggedStorage};
use std::{borrow::Cow, collections::hash_map::DefaultHasher, fmt, sync::Arc};
@ -1451,6 +1452,10 @@ impl PartialEq<ItemDefinitionIdOwned> for ItemDefinitionId<'_> {
fn eq(&self, other: &ItemDefinitionIdOwned) -> bool { other == self }
}
impl Equivalent<ItemDefinitionIdOwned> for ItemDefinitionId<'_> {
fn equivalent(&self, key: &ItemDefinitionIdOwned) -> bool { self == key }
}
#[cfg(test)]
mod tests {
use super::*;

View File

@ -107,9 +107,8 @@ impl Loadout {
time: Time,
) -> Option<Item> {
if let Some(item_def_id) = item.as_ref().map(|item| item.item_definition_id()) {
if let Some((_unequip_time, count)) = self
.recently_unequipped_items
.get_mut(&item_def_id.to_owned())
if let Some((_unequip_time, count)) =
self.recently_unequipped_items.get_mut(&item_def_id)
{
*count = count.saturating_sub(1);
}

View File

@ -910,7 +910,7 @@ impl Inventory {
&& self
.loadout
.recently_unequipped_items
.contains_key(&item.item_definition_id().to_owned())
.contains_key(&item.item_definition_id())
})
})
.map(|(slot, _item)| slot)

View File

@ -22,7 +22,7 @@ tracing = { version = "0.1", default-features = false }
vek = { version = "0.15.8", features = ["serde"] }
# Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
# ECS
specs = { version = "0.18", features = ["serde", "storage-event-control", "derive"] }

View File

@ -23,7 +23,7 @@ ordered-float = { version = "3", default-features = false }
itertools = "0.10"
# Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
indexmap = "1.3.0"
slab = "0.4.2"

View File

@ -46,7 +46,7 @@ lz-fear = { version = "0.1.1", optional = true }
async-trait = "0.1.42"
bytes = "^1"
# faster HashMaps
hashbrown = { version = ">=0.9, <0.13" }
hashbrown = { version = "0.13" }
[dev-dependencies]
tracing-subscriber = { version = "0.3.7", default-features = false, features = ["env-filter", "fmt", "time", "ansi", "smallvec"] }

View File

@ -24,7 +24,7 @@ rand = { version = "0.8" }
# async traits
async-trait = "0.1.42"
bytes = "^1"
hashbrown = { version = ">=0.12, <0.13" }
hashbrown = { version = "0.13" }
[dev-dependencies]
async-channel = "1.5.1"

View File

@ -8,7 +8,7 @@ common = { package = "veloren-common", path = "../common" }
world = { package = "veloren-world", path = "../world" }
ron = "0.8"
serde = { version = "1.0.110", features = ["derive"] }
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
enum-map = { version = "2.4", features = ["serde"] }
vek = { version = "0.15.8", features = ["serde"] }
rmp-serde = "1.1.0"

View File

@ -54,7 +54,7 @@ ron = { version = "0.8", default-features = false }
serde = { version = "1.0.110", features = ["derive"] }
serde_json = "1.0.50"
rand = { version = "0.8", features = ["small_rng"] }
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
parking_lot = { version = "0.12" }
rayon = "1.5"
crossbeam-channel = "0.5"

View File

@ -114,7 +114,7 @@ dot_vox = "5.1"
enum-iterator = "1.1.0"
guillotiere = "0.6.2"
etagere = "0.2.7"
hashbrown = {version = "0.12", features = ["rayon", "serde", "nightly"]}
hashbrown = {version = "0.13", features = ["rayon", "serde", "nightly"]}
image = {version = "0.24", default-features = false, features = ["ico", "png"]}
lazy_static = "1.4.0"
native-dialog = { version = "0.6.3", optional = true }

View File

@ -194,7 +194,7 @@ impl<'a> Widget for Group<'a> {
}
// Helper
let uid_to_name_text = |uid, client: &Client| match client.player_list().get(&uid) {
let uid_to_name_text = |uid: Uid, client: &Client| match client.player_list().get(&uid) {
Some(player_info) => player_info
.character
.as_ref()

View File

@ -29,7 +29,7 @@ vek = { version = "0.15.8", features = ["serde"] }
noise = { version = "0.7", default-features = false }
num = "0.4"
ordered-float = "3"
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
lazy_static = "1.4.0"
tracing = { version = "0.1", default-features = false }
rand = "0.8"