Skip to content

Commit ba8ca2d

Browse files
authored
chore: fix format lint (open-telemetry#3039)
1 parent c61c6f6 commit ba8ca2d

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

src/metric_helpers.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ pub fn assert_metrics_results_contains(expected_content: &str) -> Result<()> {
101101
reader.read_to_string(&mut contents)?;
102102
assert!(
103103
contents.contains(expected_content),
104-
"Expected content {} not found in actual content {}",
105-
expected_content,
106-
contents
104+
"Expected content {expected_content} not found in actual content {contents}"
107105
);
108106
Ok(())
109107
}
@@ -162,12 +160,7 @@ pub fn fetch_latest_metrics_for_scope(scope_name: &str) -> Result<Value> {
162160
None
163161
})
164162
})
165-
.with_context(|| {
166-
format!(
167-
"No valid JSON line containing scope `{}` found.",
168-
scope_name
169-
)
170-
})?;
163+
.with_context(|| format!("No valid JSON line containing scope `{scope_name}` found."))?;
171164

172165
Ok(json_line)
173166
}
@@ -178,18 +171,16 @@ pub fn fetch_latest_metrics_for_scope(scope_name: &str) -> Result<Value> {
178171
///
179172
pub fn validate_metrics_against_results(scope_name: &str) -> Result<()> {
180173
// Define the results file path
181-
let results_file_path = format!("./expected/metrics/{}.json", scope_name);
174+
let results_file_path = format!("./expected/metrics/{scope_name}.json");
182175

183176
// Fetch the actual metrics for the given scope
184177
let actual_metrics = fetch_latest_metrics_for_scope(scope_name)
185-
.context(format!("Failed to fetch metrics for scope: {}", scope_name))?;
178+
.context(format!("Failed to fetch metrics for scope: {scope_name}"))?;
186179

187180
// Read the expected metrics from the results file
188181
let expected_metrics = {
189-
let file = File::open(&results_file_path).context(format!(
190-
"Failed to open results file: {}",
191-
results_file_path
192-
))?;
182+
let file = File::open(&results_file_path)
183+
.context(format!("Failed to open results file: {results_file_path}"))?;
193184
read_metrics_from_json(file)
194185
}?;
195186

src/trace_asserter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl SpanForest {
119119
}
120120

121121
if !spans.is_empty() {
122-
panic!("found spans with invalid parent: {:?}", spans);
122+
panic!("found spans with invalid parent: {spans:?}");
123123
}
124124

125125
forest

tests/metrics_roundtrip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod metrictests_roundtrip {
3838
let metrics: MetricsData = serde_json::from_str(metrics_in)?;
3939
let metrics_out = serde_json::to_string(&metrics)?;
4040

41-
println!("{:}", metrics_out);
41+
println!("{metrics_out:}");
4242

4343
let metrics_in_json: Value = serde_json::from_str(metrics_in)?;
4444
let metrics_out_json: Value = serde_json::from_str(&metrics_out)?;

0 commit comments

Comments
 (0)