Skip to content

Commit 14875d3

Browse files
hamirmahalsunshowers
authored andcommitted
style: simplify string formatting for readability
1 parent 05d4744 commit 14875d3

File tree

18 files changed

+31
-45
lines changed

18 files changed

+31
-45
lines changed

integration-tests/tests/integration/fixtures.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ pub fn check_list_binaries_output(stdout: &[u8]) {
285285

286286
assert_eq!(
287287
expected_binary_ids, actual_binary_ids,
288-
"expected binaries:\n{:?}\nactual binaries\n{:?}",
289-
expected_binary_ids, actual_binary_ids
288+
"expected binaries:\n{expected_binary_ids:?}\nactual binaries\n{actual_binary_ids:?}"
290289
);
291290
}
292291

integration-tests/tests/integration/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn test_run_from_archive_with_no_includes() {
441441
_ = extracted_target
442442
.join(path)
443443
.symlink_metadata()
444-
.map(|_| panic!("file {} must not be included in the archive", path));
444+
.map(|_| panic!("file {path} must not be included in the archive"));
445445
}
446446
}
447447

@@ -478,7 +478,7 @@ archive.include = [
478478
_ = extracted_target
479479
.join(path)
480480
.symlink_metadata()
481-
.map(|_| panic!("file {} must not be included in the archive", path));
481+
.map(|_| panic!("file {path} must not be included in the archive"));
482482
}
483483
}
484484

integration-tests/tests/integration/temp_project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ mod unix {
143143
// This creates a Unix domain socket by binding it to a path.
144144
use std::os::unix::net::UnixListener;
145145

146-
UnixListener::bind(path).wrap_err_with(|| format!("failed to bind UDS at {}", path))?;
146+
UnixListener::bind(path).wrap_err_with(|| format!("failed to bind UDS at {path}"))?;
147147
Ok(UdsStatus::Created)
148148
}
149149
}

nextest-filtering/tests/match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fn test_expr_package_regex() {
196196
fn test_expr_binary_id_glob() {
197197
let graph = load_graph();
198198
let expr = parse("binary_id(crate_[ab])", &graph);
199-
println!("{:?}", expr);
199+
println!("{expr:?}");
200200

201201
let pid_a = mk_pid('a');
202202
let pid_b = mk_pid('b');

nextest-runner/src/cargo_config/custom_platform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl ExtractedCustomPlatform {
3434
error,
3535
})?;
3636

37-
let path = temp_dir.path().join(format!("{}.json", triple_str));
37+
let path = temp_dir.path().join(format!("{triple_str}.json"));
3838

3939
std::fs::write(&path, json).map_err(|error| {
4040
TargetTripleError::CustomPlatformWriteError {

nextest-runner/src/config/archive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl RecursionDepth {
161161
impl fmt::Display for RecursionDepth {
162162
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
163163
match self {
164-
Self::Finite(n) => write!(f, "{}", n),
164+
Self::Finite(n) => write!(f, "{n}"),
165165
Self::Infinite => write!(f, "infinite"),
166166
}
167167
}

nextest-runner/src/config/helpers.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ mod tests {
5454

5555
for &input in valid {
5656
let path = de_relative_path(input.into_deserializer())
57-
.wrap_err_with(|| format!("error deserializing valid path {:?}: error", input))?;
58-
assert_eq!(path, Utf8PathBuf::from(input), "path matches: {:?}", path);
57+
.wrap_err_with(|| format!("error deserializing valid path {input:?}: error"))?;
58+
assert_eq!(path, Utf8PathBuf::from(input), "path matches: {path:?}");
5959
}
6060

6161
for &input in invalid {
@@ -66,8 +66,7 @@ mod tests {
6666
assert_eq!(
6767
error.to_string(),
6868
format!(
69-
"invalid value: string {:?}, expected a relative path with no parent components",
70-
input
69+
"invalid value: string {input:?}, expected a relative path with no parent components"
7170
)
7271
);
7372
}

nextest-runner/src/config/nextest_version.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,7 @@ impl<'de> Deserialize<'de> for NextestVersionDeserialize {
425425
if let (Some(required), Some(recommended)) = (&required, &recommended) {
426426
if required > recommended {
427427
return Err(serde::de::Error::custom(format!(
428-
"required version ({}) must not be greater than recommended version ({})",
429-
required, recommended
428+
"required version ({required}) must not be greater than recommended version ({recommended})"
430429
)));
431430
}
432431
}
@@ -547,9 +546,7 @@ mod tests {
547546
let err = toml::from_str::<VersionOnlyDeserialize>(input).unwrap_err();
548547
assert!(
549548
err.to_string().contains(error_message),
550-
"error `{}` contains `{}`",
551-
err,
552-
error_message
549+
"error `{err}` contains `{error_message}`"
553550
);
554551
}
555552

nextest-runner/src/config/scripts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ mod tests {
700700
ConfigParseErrorKind::ExperimentalFeatureNotEnabled { feature } => {
701701
assert_eq!(*feature, ConfigExperimental::SetupScripts);
702702
}
703-
other => panic!("unexpected error kind: {:?}", other),
703+
other => panic!("unexpected error kind: {other:?}"),
704704
}
705705

706706
// Now, check with the experimental feature enabled.

nextest-runner/src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub(crate) fn convert_rel_path_to_main_sep(rel_path: &Utf8Path) -> Utf8PathBuf {
217217
pub(crate) fn rel_path_join(rel_path: &Utf8Path, path: &Utf8Path) -> Utf8PathBuf {
218218
assert!(rel_path.is_relative(), "rel_path {rel_path} is relative");
219219
assert!(path.is_relative(), "path {path} is relative",);
220-
format!("{}/{}", rel_path, path).into()
220+
format!("{rel_path}/{path}").into()
221221
}
222222

223223
#[derive(Debug)]

0 commit comments

Comments
 (0)