diff options
| author | Ubuntu <github@matdoes.dev> | 2022-11-15 20:38:32 +0000 |
|---|---|---|
| committer | Ubuntu <github@matdoes.dev> | 2022-11-15 20:38:32 +0000 |
| commit | 614c0df0537567c75f781df7affc091a4a466226 (patch) | |
| tree | ffd4b23e4692cbdd6c966d389901fbe24d0ad76b /azalea-client/src | |
| parent | 9f78b3f4a7229033a3f5acaad6c8fffbe24e3e75 (diff) | |
| download | azalea-drasl-614c0df0537567c75f781df7affc091a4a466226.tar.xz | |
clippy
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/plugins.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/azalea-client/src/plugins.rs b/azalea-client/src/plugins.rs index 1a3aa049..150d5960 100644 --- a/azalea-client/src/plugins.rs +++ b/azalea-client/src/plugins.rs @@ -7,19 +7,21 @@ use std::{ hash::BuildHasherDefault, }; +type U64Hasher = BuildHasherDefault<NoHashHasher<u64>>; + // kind of based on https://docs.rs/http/latest/src/http/extensions.rs.html /// A map of plugin ids to Plugin trait objects. The client stores this so we /// can keep the state for our plugins. /// /// If you're using azalea, you should generate this from the `plugins!` macro. -#[derive(Clone)] +#[derive(Clone, Default)] pub struct Plugins { - map: Option<HashMap<TypeId, Box<dyn Plugin>, BuildHasherDefault<NoHashHasher<u64>>>>, + map: Option<HashMap<TypeId, Box<dyn Plugin>, U64Hasher>>, } impl Plugins { pub fn new() -> Self { - Self { map: None } + Self::default() } pub fn add<T: Plugin>(&mut self, plugin: T) { @@ -46,7 +48,7 @@ impl IntoIterator for Plugins { fn into_iter(self) -> Self::IntoIter { self.map - .map(|map| map.into_iter().map(|(_, v)| v).collect::<Vec<_>>()) + .map(|map| map.into_values().collect::<Vec<_>>()) .unwrap_or_default() .into_iter() } |
