Skip to content

Commit 42cfdac

Browse files
committed
clippy::implicit_hasher
1 parent 48ead17 commit 42cfdac

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

crates/stackable-operator/src/config/fragment.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use std::{
66
collections::{BTreeMap, HashMap},
77
fmt::{Display, Write},
8-
hash::Hash,
8+
hash::{BuildHasher, Hash},
99
};
1010

1111
use k8s_openapi::api::core::v1::PodTemplateSpec;
@@ -134,7 +134,7 @@ impl<T: Atomic> FromFragment for T {
134134
fragment.ok_or_else(|| validator.error_required())
135135
}
136136
}
137-
impl<K, V: FromFragment> FromFragment for HashMap<K, V>
137+
impl<K, V: FromFragment, S: BuildHasher + Default> FromFragment for HashMap<K, V, S>
138138
where
139139
K: Eq + Hash + Display,
140140
{

crates/stackable-operator/src/config/merge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::{
44
collections::{BTreeMap, HashMap, btree_map, hash_map},
5-
hash::Hash,
5+
hash::{BuildHasher, Hash},
66
};
77

88
use k8s_openapi::{
@@ -75,7 +75,7 @@ impl<K: Ord + Clone, V: Merge + Clone> Merge for BTreeMap<K, V> {
7575
}
7676
}
7777
}
78-
impl<K: Hash + Eq + Clone, V: Merge + Clone> Merge for HashMap<K, V> {
78+
impl<K: Hash + Eq + Clone, V: Merge + Clone, S: BuildHasher> Merge for HashMap<K, V, S> {
7979
fn merge(&mut self, defaults: &Self) {
8080
for (k, default_v) in defaults {
8181
match self.entry(k.clone()) {

crates/stackable-operator/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![expect(clippy::missing_errors_doc)]
44
#![expect(clippy::must_use_candidate)]
55
#![expect(clippy::return_self_not_must_use)]
6-
#![expect(clippy::implicit_hasher)]
76
#![expect(clippy::doc_link_with_quotes)]
87
#![expect(clippy::missing_panics_doc)]
98
#![expect(clippy::explicit_deref_methods)]

crates/stackable-operator/src/product_config_utils.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::collections::{BTreeMap, HashMap};
1+
use std::{
2+
collections::{BTreeMap, HashMap},
3+
hash::BuildHasher,
4+
};
25

36
use k8s_openapi::api::core::v1::EnvVar;
47
use product_config::{ProductConfigManager, PropertyValidationResult, types::PropertyNameKind};
@@ -171,20 +174,22 @@ pub fn config_for_role_and_group<'a>(
171174
/// - `roles`: A map keyed by role names. The value is a tuple of a vector of `PropertyNameKind`
172175
/// like (Cli, Env or Files) and [`crate::role_utils::Role`] with a boxed [`Configuration`].
173176
#[allow(clippy::type_complexity)]
174-
pub fn transform_all_roles_to_config<T, U, ProductSpecificCommonConfig>(
177+
pub fn transform_all_roles_to_config<T, U, ProductSpecificCommonConfig, S>(
175178
resource: &T::Configurable,
176179
roles: &HashMap<
177180
String,
178181
(
179182
Vec<PropertyNameKind>,
180183
Role<T, U, ProductSpecificCommonConfig>,
181184
),
185+
S,
182186
>,
183187
) -> Result<RoleConfigByPropertyKind>
184188
where
185189
T: Configuration,
186190
U: Default + JsonSchema + Serialize,
187191
ProductSpecificCommonConfig: Default + JsonSchema + Serialize,
192+
S: BuildHasher,
188193
{
189194
let mut result = HashMap::new();
190195

@@ -570,8 +575,8 @@ where
570575
/// env_vars_from_rolegroup_config(&rolegroup_config)
571576
/// );
572577
/// ```
573-
pub fn env_vars_from_rolegroup_config(
574-
rolegroup_config: &HashMap<PropertyNameKind, BTreeMap<String, String>>,
578+
pub fn env_vars_from_rolegroup_config<S: BuildHasher>(
579+
rolegroup_config: &HashMap<PropertyNameKind, BTreeMap<String, String>, S>,
575580
) -> Vec<EnvVar> {
576581
env_vars_from(
577582
rolegroup_config

0 commit comments

Comments
 (0)