Skip to content

Commit 21c143d

Browse files
committed
fmt
1 parent e8a00fd commit 21c143d

5 files changed

Lines changed: 29 additions & 18 deletions

File tree

‎src/transforms/policy/adapter.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -960,9 +960,7 @@ mod tests {
960960
Some(TypedValue::String(s)) if s == "42",
961961
));
962962
assert!(matches!(
963-
adapter.get_typed_value(&LogFieldSelector::LogAttribute(
964-
vec!["flagged".to_string()],
965-
)),
963+
adapter.get_typed_value(&LogFieldSelector::LogAttribute(vec!["flagged".to_string()],)),
966964
Some(TypedValue::Bool(true)),
967965
));
968966
assert!(matches!(
@@ -972,8 +970,10 @@ mod tests {
972970
Some(TypedValue::Double(d)) if (d - 1.5).abs() < 1e-9,
973971
));
974972
// Absent attribute → None.
975-
assert!(adapter
976-
.get_typed_value(&LogFieldSelector::LogAttribute(vec!["missing".to_string()]))
977-
.is_none());
973+
assert!(
974+
adapter
975+
.get_typed_value(&LogFieldSelector::LogAttribute(vec!["missing".to_string()]))
976+
.is_none()
977+
);
978978
}
979979
}

‎src/transforms/policy/config.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,10 @@ path = "/dev/null"
453453
}
454454

455455
fn map(pairs: &[(&str, &str)]) -> HashMap<String, String> {
456-
pairs.iter().map(|(k, v)| ((*k).into(), (*v).into())).collect()
456+
pairs
457+
.iter()
458+
.map(|(k, v)| ((*k).into(), (*v).into()))
459+
.collect()
457460
}
458461

459462
fn policy_config_with_metadata(client_metadata: ClientMetadata) -> PolicyConfig {

‎src/transforms/policy/otlp_common.rs‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,11 @@ mod tests {
348348
// -- typed-value coercion -------------------------------------------
349349

350350
fn typed_str<'a>(t: TypedValue<'a>) -> Option<Cow<'a, str>> {
351-
if let TypedValue::String(s) = t { Some(s) } else { None }
351+
if let TypedValue::String(s) = t {
352+
Some(s)
353+
} else {
354+
None
355+
}
352356
}
353357

354358
#[test]
@@ -377,14 +381,20 @@ mod tests {
377381
fn any_value_typed_int_from_json_string() {
378382
// OTLP/JSON encodes int64 as a JSON string for JS safety.
379383
let av = v(json!({"intValue": "42"}));
380-
assert!(matches!(any_value_typed(Some(&av)), Some(TypedValue::Int(42))));
384+
assert!(matches!(
385+
any_value_typed(Some(&av)),
386+
Some(TypedValue::Int(42))
387+
));
381388
}
382389

383390
#[test]
384391
fn any_value_typed_int_from_native_integer() {
385392
// Protobuf decoding may yield a native integer rather than a string.
386393
let av = v(json!({"intValue": 42}));
387-
assert!(matches!(any_value_typed(Some(&av)), Some(TypedValue::Int(42))));
394+
assert!(matches!(
395+
any_value_typed(Some(&av)),
396+
Some(TypedValue::Int(42))
397+
));
388398
}
389399

390400
#[test]
@@ -442,10 +452,7 @@ mod tests {
442452
Some(TypedValue::Bool(true)),
443453
));
444454
assert!(matches!(
445-
find_attribute_typed_path(
446-
Some(&attrs),
447-
&["http".to_string(), "status".to_string()],
448-
),
455+
find_attribute_typed_path(Some(&attrs), &["http".to_string(), "status".to_string()],),
449456
Some(TypedValue::Int(500)),
450457
));
451458
// Missing keys still resolve to None.

‎src/transforms/policy/otlp_log_adapter.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ impl Matchable for OtlpLogAdapter<'_> {
262262

263263
fn get_typed_value(&self, field: &LogFieldSelector) -> Option<TypedValue<'_>> {
264264
match field {
265-
LogFieldSelector::Simple(LogField::Body) => any_value_typed(self.log_record.get("body")),
265+
LogFieldSelector::Simple(LogField::Body) => {
266+
any_value_typed(self.log_record.get("body"))
267+
}
266268
LogFieldSelector::Simple(LogField::Unspecified) => None,
267269
LogFieldSelector::Simple(_) => self.get_field(field).map(TypedValue::String),
268270
LogFieldSelector::LogAttribute(path)

‎src/transforms/policy/otlp_trace_adapter.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,8 @@ mod tests {
561561

562562
#[test]
563563
fn typed_value_surfaces_int_span_attribute() {
564-
let mut span = val(
565-
json!({"attributes": [{"key": "http.status_code", "value": {"intValue": "500"}}]}),
566-
);
564+
let mut span =
565+
val(json!({"attributes": [{"key": "http.status_code", "value": {"intValue": "500"}}]}));
567566
let adapter = TraceAdapter {
568567
span: &mut span,
569568
resource: None,

0 commit comments

Comments
 (0)