Skip to content

Commit e976192

Browse files
committed
style: fix rustfmt formatting in tonic test closures
1 parent 9e8bbfe commit e976192

File tree

1 file changed

+37
-46
lines changed
  • opentelemetry-otlp/src/exporter/tonic

1 file changed

+37
-46
lines changed

opentelemetry-otlp/src/exporter/tonic/mod.rs

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,22 +1046,19 @@ mod tests {
10461046
// INSECURE=false (default) + schemeless endpoint → https:// prepended → error (no TLS)
10471047
// Unset signal-specific var to ensure generic takes effect
10481048
temp_env::with_var_unset(crate::OTEL_EXPORTER_OTLP_TRACES_INSECURE, || {
1049-
run_env_test(
1050-
vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")],
1051-
|| {
1052-
let result = SpanExporter::builder()
1053-
.with_tonic()
1054-
.with_endpoint("collector.example.com:4317")
1055-
.build();
1056-
1057-
assert!(result.is_err());
1058-
let err = result.unwrap_err();
1059-
assert!(
1060-
matches!(err, ExporterBuildError::InvalidConfig { .. }),
1061-
"expected InvalidConfig error for schemeless+secure without TLS, got: {err:?}"
1062-
);
1063-
},
1064-
);
1049+
run_env_test(vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")], || {
1050+
let result = SpanExporter::builder()
1051+
.with_tonic()
1052+
.with_endpoint("collector.example.com:4317")
1053+
.build();
1054+
1055+
assert!(result.is_err());
1056+
let err = result.unwrap_err();
1057+
assert!(
1058+
matches!(err, ExporterBuildError::InvalidConfig { .. }),
1059+
"expected InvalidConfig error for schemeless+secure without TLS, got: {err:?}"
1060+
);
1061+
});
10651062
});
10661063
}
10671064

@@ -1080,21 +1077,18 @@ mod tests {
10801077
// INSECURE=true + schemeless endpoint → http:// prepended → no TLS needed
10811078
// Unset signal-specific var to ensure generic takes effect
10821079
temp_env::with_var_unset(crate::OTEL_EXPORTER_OTLP_TRACES_INSECURE, || {
1083-
run_env_test(
1084-
vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "true")],
1085-
|| {
1086-
let result = SpanExporter::builder()
1087-
.with_tonic()
1088-
.with_endpoint("collector.example.com:4317")
1089-
.build();
1090-
1091-
assert!(
1092-
result.is_ok(),
1093-
"schemeless + INSECURE=true should succeed without TLS, got: {:?}",
1094-
result.unwrap_err()
1095-
);
1096-
},
1097-
);
1080+
run_env_test(vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "true")], || {
1081+
let result = SpanExporter::builder()
1082+
.with_tonic()
1083+
.with_endpoint("collector.example.com:4317")
1084+
.build();
1085+
1086+
assert!(
1087+
result.is_ok(),
1088+
"schemeless + INSECURE=true should succeed without TLS, got: {:?}",
1089+
result.unwrap_err()
1090+
);
1091+
});
10981092
});
10991093
}
11001094

@@ -1142,21 +1136,18 @@ mod tests {
11421136
// Explicit http:// scheme should succeed regardless of INSECURE value
11431137
// Unset signal-specific var to ensure generic takes effect
11441138
temp_env::with_var_unset(crate::OTEL_EXPORTER_OTLP_TRACES_INSECURE, || {
1145-
run_env_test(
1146-
vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")],
1147-
|| {
1148-
let result = SpanExporter::builder()
1149-
.with_tonic()
1150-
.with_endpoint("http://collector.example.com:4317")
1151-
.build();
1152-
1153-
assert!(
1154-
result.is_ok(),
1155-
"explicit http:// should succeed even with INSECURE=false, got: {:?}",
1156-
result.unwrap_err()
1157-
);
1158-
},
1159-
);
1139+
run_env_test(vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")], || {
1140+
let result = SpanExporter::builder()
1141+
.with_tonic()
1142+
.with_endpoint("http://collector.example.com:4317")
1143+
.build();
1144+
1145+
assert!(
1146+
result.is_ok(),
1147+
"explicit http:// should succeed even with INSECURE=false, got: {:?}",
1148+
result.unwrap_err()
1149+
);
1150+
});
11601151
});
11611152
}
11621153

0 commit comments

Comments
 (0)