Skip to content

Commit c5d919d

Browse files
committed
style: fix rustfmt formatting in tonic test closures
1 parent 274209e commit c5d919d

1 file changed

Lines changed: 37 additions & 46 deletions

File tree

  • opentelemetry-otlp/src/exporter/tonic

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

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,22 +1105,19 @@ mod tests {
11051105
// INSECURE=false (default) + schemeless endpoint → https:// prepended → error (no TLS)
11061106
// Unset signal-specific var to ensure generic takes effect
11071107
temp_env::with_var_unset(crate::OTEL_EXPORTER_OTLP_TRACES_INSECURE, || {
1108-
run_env_test(
1109-
vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")],
1110-
|| {
1111-
let result = SpanExporter::builder()
1112-
.with_tonic()
1113-
.with_endpoint("collector.example.com:4317")
1114-
.build();
1115-
1116-
assert!(result.is_err());
1117-
let err = result.unwrap_err();
1118-
assert!(
1119-
matches!(err, ExporterBuildError::InvalidConfig { .. }),
1120-
"expected InvalidConfig error for schemeless+secure without TLS, got: {err:?}"
1121-
);
1122-
},
1123-
);
1108+
run_env_test(vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")], || {
1109+
let result = SpanExporter::builder()
1110+
.with_tonic()
1111+
.with_endpoint("collector.example.com:4317")
1112+
.build();
1113+
1114+
assert!(result.is_err());
1115+
let err = result.unwrap_err();
1116+
assert!(
1117+
matches!(err, ExporterBuildError::InvalidConfig { .. }),
1118+
"expected InvalidConfig error for schemeless+secure without TLS, got: {err:?}"
1119+
);
1120+
});
11241121
});
11251122
}
11261123

@@ -1139,21 +1136,18 @@ mod tests {
11391136
// INSECURE=true + schemeless endpoint → http:// prepended → no TLS needed
11401137
// Unset signal-specific var to ensure generic takes effect
11411138
temp_env::with_var_unset(crate::OTEL_EXPORTER_OTLP_TRACES_INSECURE, || {
1142-
run_env_test(
1143-
vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "true")],
1144-
|| {
1145-
let result = SpanExporter::builder()
1146-
.with_tonic()
1147-
.with_endpoint("collector.example.com:4317")
1148-
.build();
1149-
1150-
assert!(
1151-
result.is_ok(),
1152-
"schemeless + INSECURE=true should succeed without TLS, got: {:?}",
1153-
result.unwrap_err()
1154-
);
1155-
},
1156-
);
1139+
run_env_test(vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "true")], || {
1140+
let result = SpanExporter::builder()
1141+
.with_tonic()
1142+
.with_endpoint("collector.example.com:4317")
1143+
.build();
1144+
1145+
assert!(
1146+
result.is_ok(),
1147+
"schemeless + INSECURE=true should succeed without TLS, got: {:?}",
1148+
result.unwrap_err()
1149+
);
1150+
});
11571151
});
11581152
}
11591153

@@ -1201,21 +1195,18 @@ mod tests {
12011195
// Explicit http:// scheme should succeed regardless of INSECURE value
12021196
// Unset signal-specific var to ensure generic takes effect
12031197
temp_env::with_var_unset(crate::OTEL_EXPORTER_OTLP_TRACES_INSECURE, || {
1204-
run_env_test(
1205-
vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")],
1206-
|| {
1207-
let result = SpanExporter::builder()
1208-
.with_tonic()
1209-
.with_endpoint("http://collector.example.com:4317")
1210-
.build();
1211-
1212-
assert!(
1213-
result.is_ok(),
1214-
"explicit http:// should succeed even with INSECURE=false, got: {:?}",
1215-
result.unwrap_err()
1216-
);
1217-
},
1218-
);
1198+
run_env_test(vec![(crate::OTEL_EXPORTER_OTLP_INSECURE, "false")], || {
1199+
let result = SpanExporter::builder()
1200+
.with_tonic()
1201+
.with_endpoint("http://collector.example.com:4317")
1202+
.build();
1203+
1204+
assert!(
1205+
result.is_ok(),
1206+
"explicit http:// should succeed even with INSECURE=false, got: {:?}",
1207+
result.unwrap_err()
1208+
);
1209+
});
12191210
});
12201211
}
12211212

0 commit comments

Comments
 (0)