Skip to content

Commit

Permalink
Merge pull request #512 from hamirmahal/style/simplify-string-interpo…
Browse files Browse the repository at this point in the history
…lation

style: simplify string interpolation
  • Loading branch information
hatoo authored Jun 6, 2024
2 parents c2a9854 + f5b25c4 commit 72f7dfb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,10 @@ fn system_resolv_conf() -> anyhow::Result<(ResolverConfig, ResolverOpts)> {
#[cfg(unix)]
if env::var("TERMUX_VERSION").is_ok() {
let prefix = env::var("PREFIX")?;
let path = format!("{}/etc/resolv.conf", prefix);
let conf_data = std::fs::read(&path).context(format!("DNS: failed to load {}", path))?;
let path = format!("{prefix}/etc/resolv.conf");
let conf_data = std::fs::read(&path).context(format!("DNS: failed to load {path}"))?;
return hickory_resolver::system_conf::parse_resolv_conf(conf_data)
.context(format!("DNS: failed to parse {}", path));
.context(format!("DNS: failed to parse {path}"));
}

hickory_resolver::system_conf::read_system_conf()
Expand Down
4 changes: 2 additions & 2 deletions src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ fn print_summary<W: Write>(
w,
"{}",
style.success_rate(
&format!(" Success rate:\t{:.2}%", success_rate),
&format!(" Success rate:\t{success_rate:.2}%"),
success_rate
)
)?;
Expand Down Expand Up @@ -597,7 +597,7 @@ fn print_distribution<W: Write>(
writeln!(
w,
"{}",
style.latency_distribution(&format!(" {:.2}% in {:.4} secs", p, v), *v)
style.latency_distribution(&format!(" {p:.2}% in {v:.4} secs"), *v)
)?;
}

Expand Down
2 changes: 1 addition & 1 deletion src/url_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mod tests {
fn test_url_generator_dynamic() {
let path_regex = "/[a-z][a-z][0-9]";
let url_generator = UrlGenerator::new_dynamic(
RandRegex::compile(&format!(r"http://127\.0\.0\.1{}", path_regex), 4).unwrap(),
RandRegex::compile(&format!(r"http://127\.0\.0\.1{path_regex}"), 4).unwrap(),
);
let url = url_generator.generate(&mut thread_rng()).unwrap();
assert_eq!(url.host(), Some(Host::Ipv4(Ipv4Addr::new(127, 0, 0, 1))));
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,14 +763,14 @@ async fn test_json_schema() {

if let Err(errors) = schema.validate(&value) {
for error in errors {
eprintln!("{}", error);
eprintln!("{error}");
}
panic!("JSON schema validation failed\n{output_json}");
}

if let Err(errors) = schema.validate(&value_stats_success_breakdown) {
for error in errors {
eprintln!("{}", error);
eprintln!("{error}");
}
panic!("JSON schema validation failed\n{output_json_stats_success_breakdown}");
}/* ?? */;
Expand Down

0 comments on commit 72f7dfb

Please sign in to comment.