Skip to content

Commit 9c3afc1

Browse files
committed
fix: clippy
Signed-off-by: c <[email protected]>
1 parent 1dbf088 commit 9c3afc1

File tree

6 files changed

+14
-17
lines changed

6 files changed

+14
-17
lines changed

src/api/client.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,7 @@ mod tests {
622622

623623
let client = create_client(provider).await;
624624

625-
assert_eq!(
626-
client.get_bool_value("key", None, None).await.unwrap(),
627-
true
628-
);
625+
assert!(client.get_bool_value("key", None, None).await.unwrap());
629626

630627
assert_eq!(client.get_int_value("key", None, None).await.unwrap(), 123);
631628

src/evaluation/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ mod tests {
9595
fn merge_missing_given_targeting_key() {
9696
let mut context = EvaluationContext::default()
9797
.with_targeting_key("Targeting Key")
98-
.to_owned();
98+
.clone();
9999

100100
let expected = context.clone();
101101

@@ -122,7 +122,7 @@ mod tests {
122122
.with_targeting_key("Targeting Key")
123123
.with_custom_field("Key", "Value")
124124
.with_custom_field("Another Key", "Value")
125-
)
125+
);
126126
}
127127

128128
#[test]

src/evaluation/context_field_value.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ mod tests {
228228
.with_custom_field("Int", 42)
229229
.with_custom_field("Float", 42.0)
230230
.with_custom_field("String", "StringValue")
231-
.with_custom_field("DateTime", now.clone())
231+
.with_custom_field("DateTime", now)
232232
.with_custom_field(
233233
"Struct",
234234
EvaluationContextFieldValue::new_struct(EvaluationReason::Cached),
@@ -237,7 +237,7 @@ mod tests {
237237
// Assert bool
238238
if let EvaluationContextFieldValue::Bool(value) = context.custom_fields.get("Bool").unwrap()
239239
{
240-
assert_eq!(true, *value);
240+
assert!(*value);
241241
} else {
242242
panic!()
243243
}
@@ -284,6 +284,6 @@ mod tests {
284284
assert_eq!(EvaluationReason::Cached, *v);
285285
} else {
286286
panic!()
287-
};
287+
}
288288
}
289289
}

src/evaluation/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ mod tests {
258258

259259
let is_male = alex.fields.get("is_male").unwrap();
260260
assert!(is_male.is_bool());
261-
assert_eq!(false, is_male.as_bool().unwrap());
261+
assert!(!is_male.as_bool().unwrap());
262262

263263
let id = alex.fields.get("id").unwrap();
264264
assert!(id.is_i64());

src/hooks/logging.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl LoggingHook {
102102

103103
#[cfg(feature = "structured-logging")]
104104
mod structured {
105-
use super::*;
105+
use super::{LoggingHook, HookContext, EvaluationDetails, Value, EvaluationError};
106106
use log::{kv::Value as LogValue, Level, Record};
107107

108108
const DOMAIN_KEY: &str = "domain";
@@ -154,7 +154,7 @@ mod structured {
154154
// See issue https://github.com/rust-lang/rust/issues/92698
155155
log::logger().log(
156156
&Record::builder()
157-
.args(format_args!("{}", msg))
157+
.args(format_args!("{msg}"))
158158
.level(level)
159159
.target("open_feature")
160160
.module_path_static(Some(module_path!()))
@@ -188,9 +188,9 @@ mod structured {
188188
}
189189
}
190190

191-
fn evaluation_details_to_kvs<'a>(
192-
details: &'a EvaluationDetails<Value>,
193-
) -> Vec<(&'static str, LogValue<'a>)> {
191+
fn evaluation_details_to_kvs(
192+
details: &EvaluationDetails<Value>,
193+
) -> Vec<(&'static str, LogValue<'_>)> {
194194
let kvs = vec![
195195
(REASON_KEY, LogValue::from_debug(&details.reason)),
196196
(VARIANT_KEY, LogValue::from_debug(&details.variant)),
@@ -200,7 +200,7 @@ mod structured {
200200
kvs
201201
}
202202

203-
fn error_to_kvs<'a>(error: &'a EvaluationError) -> Vec<(&'static str, LogValue<'a>)> {
203+
fn error_to_kvs(error: &EvaluationError) -> Vec<(&'static str, LogValue<'_>)> {
204204
let kvs = vec![(ERROR_MESSAGE_KEY, LogValue::from_debug(&error.message))];
205205

206206
kvs

src/serde_json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn json_value_to_value(value: &serde_json::Value) -> EvaluationResult<Value> {
2929
serde_json::Value::Array(array) => Ok(Value::Array(
3030
array
3131
.iter()
32-
.map(|x| json_value_to_value(x))
32+
.map(json_value_to_value)
3333
.collect::<Result<Vec<_>, _>>()?,
3434
)),
3535
serde_json::Value::Object(object) => {

0 commit comments

Comments
 (0)