From 05204864d68186a0a542b77e9d073bc7e5428cea Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 7 Feb 2026 04:05:44 -0500 Subject: [PATCH] refactor: inline format! args in a few places (#10730) * refactor: inline format! args in a few places * in one spot remove redundant mem alloc * run clippy fix with mixed --- .clippy.toml | 1 + src/common/validation.rs | 3 +-- src/uu/chmod/src/chmod.rs | 13 +++---------- src/uu/cp/src/cp.rs | 2 +- src/uu/dd/src/dd.rs | 2 +- src/uu/env/src/env.rs | 2 +- src/uu/id/src/id.rs | 4 +--- src/uu/join/benches/join_bench.rs | 2 +- src/uu/mknod/src/mknod.rs | 4 ++-- src/uu/mv/src/hardlink.rs | 9 ++++----- src/uu/od/src/multifile_reader.rs | 2 +- src/uu/od/src/od.rs | 2 +- src/uu/od/src/output_info.rs | 3 +-- src/uu/od/src/parse_inputs.rs | 8 ++++---- src/uu/pr/src/pr.rs | 7 ++----- src/uu/sort/src/ext_sort.rs | 3 +-- src/uu/sort/src/sort.rs | 9 ++++----- src/uu/stat/src/stat.rs | 3 +-- src/uu/stty/src/stty.rs | 2 +- src/uu/tr/src/operation.rs | 4 ++-- src/uu/tsort/benches/tsort_bench.rs | 10 +++------- src/uucore/src/lib/features/format/num_format.rs | 2 +- src/uucore/src/lib/features/perms.rs | 5 ++--- src/uucore/src/lib/features/selinux.rs | 2 +- tests/by-util/test_cp.rs | 3 +-- tests/by-util/test_date.rs | 3 +-- tests/by-util/test_du.rs | 4 ++-- tests/by-util/test_ls.rs | 4 ++-- tests/by-util/test_mkdir.rs | 4 +--- tests/by-util/test_rm.rs | 2 +- tests/test_uudoc.rs | 6 ++---- 31 files changed, 51 insertions(+), 79 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index 113f003ad..f5d31e363 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -2,3 +2,4 @@ avoid-breaking-exported-api = false check-private-items = true cognitive-complexity-threshold = 24 missing-docs-in-crate-items = true +allow-mixed-uninlined-format-args = false diff --git a/src/common/validation.rs b/src/common/validation.rs index 41f686e8d..81ae1351c 100644 --- a/src/common/validation.rs +++ b/src/common/validation.rs @@ -32,8 +32,7 @@ pub fn not_found(util: &OsStr) -> ! { /// Prints an "unrecognized option" error and exits pub fn unrecognized_option(binary_name: &str, option: &OsStr) -> ! { eprintln!( - "{}: unrecognized option '{}'", - binary_name, + "{binary_name}: unrecognized option '{}'", option.to_string_lossy() ); process::exit(1); diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 78dccffdc..127464dc1 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -318,19 +318,13 @@ impl Chmoder { if new_mode != old_mode { println!( - "mode of {} changed from {:04o} ({}) to {:04o} ({})", + "mode of {} changed from {old_mode:04o} ({current_permissions}) to {new_mode:04o} ({new_permissions})", file_path.quote(), - old_mode, - current_permissions, - new_mode, - new_permissions ); } else if self.verbose { println!( - "mode of {} retained as {:04o} ({})", + "mode of {} retained as {old_mode:04o} ({current_permissions})", file_path.quote(), - old_mode, - current_permissions ); } } @@ -600,9 +594,8 @@ impl Chmoder { if let Err(_e) = dir_fd.chmod_at(entry_name, new_mode, follow_symlinks) { if self.verbose { println!( - "failed to change mode of {} to {:o}", + "failed to change mode of {} to {new_mode:o}", file_path.quote(), - new_mode ); } return Err(ChmodError::PermissionDenied(file_path.into()).into()); diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 8fb5629fa..5c6c0979b 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1344,7 +1344,7 @@ fn show_error_if_needed(error: &CpError) { // Format IoErrContext using strip_errno to remove "(os error N)" suffix // for GNU-compatible output CpError::IoErrContext(io_err, context) => { - show_error!("{}: {}", context, uucore::error::strip_errno(io_err)); + show_error!("{context}: {}", uucore::error::strip_errno(io_err)); } _ => { show_error!("{error}"); diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 48f7ef1b9..bddbe37ac 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -748,7 +748,7 @@ fn handle_o_direct_write(f: &mut File, buf: &[u8], original_error: io::Error) -> // Log any restoration errors without failing the operation if let Err(os_err) = fcntl(&mut *f, FcntlArg::F_SETFL(oflags)) { // Just log the error, don't fail the whole operation - show_error!("Failed to restore O_DIRECT flag: {}", os_err); + show_error!("Failed to restore O_DIRECT flag: {os_err}"); } write_result diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 5e56fbd04..c12cc671b 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -1091,7 +1091,7 @@ fn list_signal_handling(log: &SignalActionLog) { SignalActionKind::Block => "BLOCK", }; let signal_name = signal_name_by_value(sig_value).unwrap_or("?"); - eprintln!("{:<10} ({}): {}", signal_name, sig_value as i32, action); + eprintln!("{signal_name:<10} ({}): {action}", sig_value as i32); } } diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 880768333..5bd27bc3e 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -223,9 +223,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } else { show_error!( "{}", - translate!("id-error-no-such-user", - "user" => users[i].quote() - ) + translate!("id-error-no-such-user", "user" => users[i].quote()) ); set_exit_code(1); if i + 1 >= users.len() { diff --git a/src/uu/join/benches/join_bench.rs b/src/uu/join/benches/join_bench.rs index 800bfa96d..4a18fb51e 100644 --- a/src/uu/join/benches/join_bench.rs +++ b/src/uu/join/benches/join_bench.rs @@ -50,7 +50,7 @@ fn create_partial_overlap_files( // File 2: keys (num_lines - overlap_count) to (2*num_lines - overlap_count - 1) let start = num_lines - overlap_count; for i in 0..num_lines { - writeln!(file2, "{:08} f2_data_{}", start + i, i).unwrap(); + writeln!(file2, "{:08} f2_data_{i}", start + i).unwrap(); } ( diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 9ab0af057..50aa70755 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -95,7 +95,7 @@ fn mknod(file_name: &str, config: Config) -> i32 { ) { // if it fails, delete the file let _ = std::fs::remove_file(file_name); - eprintln!("{}: {}", uucore::util_name(), e); + eprintln!("{}: {e}", uucore::util_name()); return 1; } } @@ -108,7 +108,7 @@ fn mknod(file_name: &str, config: Config) -> i32 { std::fs::remove_file(p) }) { - eprintln!("{}: {}", uucore::util_name(), e); + eprintln!("{}: {e}", uucore::util_name()); return 1; } } diff --git a/src/uu/mv/src/hardlink.rs b/src/uu/mv/src/hardlink.rs index 8c4ea7b33..61ad74d47 100644 --- a/src/uu/mv/src/hardlink.rs +++ b/src/uu/mv/src/hardlink.rs @@ -65,7 +65,7 @@ impl std::fmt::Display for HardlinkError { ) } Self::Metadata { path, error } => { - write!(f, "Metadata access error for {}: {}", path.quote(), error) + write!(f, "Metadata access error for {}: {error}", path.quote()) } } } @@ -99,9 +99,8 @@ impl From for io::Error { )), HardlinkError::Metadata { path, error } => Self::other(format!( - "Metadata access error for {}: {}", + "Metadata access error for {}: {error}", path.quote(), - error )), } } @@ -127,7 +126,7 @@ impl HardlinkTracker { Err(e) => { // Gracefully handle metadata errors by logging and continuing without hardlink tracking if options.verbose { - eprintln!("warning: cannot get metadata for {}: {}", source.quote(), e); + eprintln!("warning: cannot get metadata for {}: {e}", source.quote()); } return None; } @@ -180,7 +179,7 @@ impl HardlinkGroupScanner { if let Err(e) = self.scan_single_path(file) { if options.verbose { // Only show warnings for verbose mode - eprintln!("warning: failed to scan {}: {}", file.quote(), e); + eprintln!("warning: failed to scan {}: {e}", file.quote()); } // For non-verbose mode, silently continue for missing files // This provides graceful degradation - we'll lose hardlink info for this file diff --git a/src/uu/od/src/multifile_reader.rs b/src/uu/od/src/multifile_reader.rs index 48e1f1225..4213fde90 100644 --- a/src/uu/od/src/multifile_reader.rs +++ b/src/uu/od/src/multifile_reader.rs @@ -93,7 +93,7 @@ impl MultifileReader<'_> { io::ErrorKind::PermissionDenied => "Permission denied", _ => "I/O error", }; - show_error!("{}: {}", fname.maybe_quote().external(true), error_msg); + show_error!("{}: {error_msg}", fname.maybe_quote().external(true)); self.any_err = true; } } diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 4da705aae..67992d769 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -658,7 +658,7 @@ fn extract_strings_from_input( // Note: GNU od does not output unterminated strings at EOF // Strings must be null-terminated to be output if mf.has_error() { - show_error!("{}", e); + show_error!("{e}"); return Err(1.into()); } break; diff --git a/src/uu/od/src/output_info.rs b/src/uu/od/src/output_info.rs index ef63c1602..86c481b0d 100644 --- a/src/uu/od/src/output_info.rs +++ b/src/uu/od/src/output_info.rs @@ -222,10 +222,9 @@ fn assert_alignment( assert_eq!( expected, &spacing[..byte_size_block], - "unexpected spacing for byte_size={} print_width={} block_width={}", + "unexpected spacing for byte_size={} print_width={} block_width={print_width_block}", type_info.byte_size, type_info.print_width, - print_width_block ); assert!( spacing[byte_size_block..].iter().all(|&s| s == 0), diff --git a/src/uu/od/src/parse_inputs.rs b/src/uu/od/src/parse_inputs.rs index b6f763b2e..3d6263e56 100644 --- a/src/uu/od/src/parse_inputs.rs +++ b/src/uu/od/src/parse_inputs.rs @@ -91,7 +91,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result Result Err(format!("{}: {}", input_strings[1], e)), + (_, Err(e)) => Err(format!("{}: {e}", input_strings[1])), } } 3 => { @@ -148,8 +148,8 @@ pub fn parse_inputs_traditional(input_strings: &[&str]) -> Result Err(format!("{}: {}", input_strings[1], e)), - (_, Err(e)) => Err(format!("{}: {}", input_strings[2], e)), + (Err(e), _) => Err(format!("{}: {e}", input_strings[1])), + (_, Err(e)) => Err(format!("{}: {e}", input_strings[2])), } } _ => Err(translate!("od-error-too-many-inputs", "input" => input_strings[3])), diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 25a1e2e3e..f000abbd7 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -1264,11 +1264,8 @@ fn header_content(options: &OutputOptions, page: usize) -> Vec { let padding_after_filename = space_for_filename - filename_len - padding_before_filename; format!( - "{date_part}{:width1$}{filename}{:width2$}{page_part}", - "", - "", - width1 = padding_before_filename, - width2 = padding_after_filename + "{date_part}{:padding_before_filename$}{filename}{:padding_after_filename$}{page_part}", + "", "" ) } else { // If content is too long, just use single spaces diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index d61f7d200..6e4e98a58 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -70,8 +70,7 @@ pub fn ext_sort( Err(err) => { // Print the error and disable compression eprintln!( - "sort: could not run compress program '{}': {}", - prog, + "sort: could not run compress program '{prog}': {}", strip_errno(&err) ); effective_settings.compress_prog = None; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ceaf51256..26b060a45 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1467,7 +1467,7 @@ struct LegacyKeyWarning { impl LegacyKeyWarning { fn legacy_key_display(&self) -> String { match self.to_field { - Some(to) => format!("+{} -{}", self.from_field, to), + Some(to) => format!("+{} -{to}", self.from_field), None => format!("+{}", self.from_field), } } @@ -1569,14 +1569,13 @@ fn legacy_key_to_k(from: &LegacyKeyPart, to: Option<&LegacyKeyPart>) -> String { let start_char = from.char_pos.saturating_add(1); let mut keydef = format!( - "{}{}{}", - start_field, + "{start_field}{}{}", if from.char_pos == 0 { String::new() } else { format!(".{start_char}") }, - from.opts + from.opts, ); if let Some(to) = to { @@ -2150,7 +2149,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { #[cfg(target_os = "linux")] { - show_error!("{}", batch_too_large); + show_error!("{batch_too_large}"); translate!( "sort-maximum-batch-size-rlimit", diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 8e044ed77..65b6e0540 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -1303,13 +1303,12 @@ impl Stater { }; format!( - " {}: %N\n {}: %-10s\t{}: %-10b {} {}: %-6o %F\n{}{}: (%04a/%10.10A) {}: (%5u/%8U) {}: (%5g/%8G)\n{}: %x\n{}: %y\n{}: %z\n {}: %w\n", + " {}: %N\n {}: %-10s\t{}: %-10b {} {}: %-6o %F\n{device_line}{}: (%04a/%10.10A) {}: (%5u/%8U) {}: (%5g/%8G)\n{}: %x\n{}: %y\n{}: %z\n {}: %w\n", translate!("stat-word-file"), translate!("stat-word-size"), translate!("stat-word-blocks"), translate!("stat-word-io"), translate!("stat-word-block"), - device_line, translate!("stat-word-access"), translate!("stat-word-uid"), translate!("stat-word-gid"), diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index af54db3e9..e6336aab1 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -595,7 +595,7 @@ impl WrappedPrinter { self.first_in_line = true; } - print!("{}{}", self.prefix(), token); + print!("{}{token}", self.prefix()); self.current += token_len; self.first_in_line = false; } diff --git a/src/uu/tr/src/operation.rs b/src/uu/tr/src/operation.rs index 0c62840e0..e2ba2bd83 100644 --- a/src/uu/tr/src/operation.rs +++ b/src/uu/tr/src/operation.rs @@ -547,8 +547,8 @@ impl Sequence { (Ok(c), Ok(())) => Ok(Self::Char(c)), (Ok(c), Err(v)) => Err(BadSequence::MultipleCharInEquivalence(format!( "{}{}", - String::from_utf8_lossy(&[c]).into_owned(), - String::from_utf8_lossy(v).into_owned() + String::from_utf8_lossy(&[c]), + String::from_utf8_lossy(v), ))), }, ) diff --git a/src/uu/tsort/benches/tsort_bench.rs b/src/uu/tsort/benches/tsort_bench.rs index 18d121d66..28395cffd 100644 --- a/src/uu/tsort/benches/tsort_bench.rs +++ b/src/uu/tsort/benches/tsort_bench.rs @@ -12,7 +12,7 @@ fn generate_linear_chain(num_nodes: usize) -> Vec { let mut data = Vec::new(); for i in 0..num_nodes.saturating_sub(1) { - data.extend_from_slice(format!("node{} node{}\n", i, i + 1).as_bytes()); + data.extend_from_slice(format!("node{i} node{}\n", i + 1).as_bytes()); } data @@ -85,10 +85,8 @@ fn generate_wide_dag(num_nodes: usize) -> Vec { for i in chain_start..chain_end.saturating_sub(1) { data.extend_from_slice( format!( - "chain{}_{} chain{}_{}\n", - chain, + "chain{chain}_{} chain{chain}_{}\n", i - chain_start, - chain, i + 1 - chain_start ) .as_bytes(), @@ -102,10 +100,8 @@ fn generate_wide_dag(num_nodes: usize) -> Vec { let curr_mid = chain_start + chain_length / 4; data.extend_from_slice( format!( - "chain{}_{} chain{}_{}\n", - prev_chain, + "chain{prev_chain}_{} chain{chain}_{}\n", prev_end - prev_chain * chain_length, - chain, curr_mid - chain_start ) .as_bytes(), diff --git a/src/uucore/src/lib/features/format/num_format.rs b/src/uucore/src/lib/features/format/num_format.rs index 9a09b3f7d..9d44491b4 100644 --- a/src/uucore/src/lib/features/format/num_format.rs +++ b/src/uucore/src/lib/features/format/num_format.rs @@ -425,7 +425,7 @@ fn format_float_scientific( return if force_decimal == ForceDecimal::Yes && precision == 0 { format!("0.{exp_char}+00") } else { - format!("{:.*}{exp_char}+00", precision, 0.0) + format!("{:.precision$}{exp_char}+00", 0.0) }; } diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index e9aaf875d..467406b45 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -388,14 +388,13 @@ impl ChownExecutor { // Use fchown (safe) to change the directory's ownership if let Err(e) = dir_fd.fchown(self.dest_uid, self.dest_gid) { let mut error_msg = format!( - "changing {} of {}: {}", + "changing {} of {}: {e}", if self.verbosity.groups_only { "group" } else { "ownership" }, path.quote(), - e ); if self.verbosity.level == VerbosityLevel::Verbose { @@ -521,7 +520,7 @@ impl ChownExecutor { entry_path.quote(), strip_errno(&e) ); - show_error!("{}", msg); + show_error!("{msg}"); } } else { // Report the successful ownership change using the shared helper diff --git a/src/uucore/src/lib/features/selinux.rs b/src/uucore/src/lib/features/selinux.rs index ed79be414..da0297d00 100644 --- a/src/uucore/src/lib/features/selinux.rs +++ b/src/uucore/src/lib/features/selinux.rs @@ -365,7 +365,7 @@ pub fn preserve_security_context(from_path: &Path, to_path: &Path) -> Result<(), /// use uucore::selinux::get_getfattr_output; /// /// let context = get_getfattr_output("/path/to/file"); -/// println!("SELinux context: {}", context); +/// println!("SELinux context: {context}"); /// ``` pub fn get_getfattr_output(f: &str) -> String { use std::process::Command; diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index f01619af2..1508b8fc0 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -6500,8 +6500,7 @@ fn test_cp_archive_preserves_directory_permissions() { assert_eq!( mode & 0o777, 0o755, - "Directory {} has incorrect permissions: {:o}", - path, + "Directory {path} has incorrect permissions: {:o}", mode & 0o777 ); }; diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 923922f2b..7a5625a01 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -419,8 +419,7 @@ fn test_date_set_hyphen_prefixed_values() { // permission error, not argument parsing error assert!( result.stderr_str().starts_with("date: cannot set date: "), - "Expected permission error for '{}', but got: {}", - date_str, + "Expected permission error for '{date_str}', but got: {}", result.stderr_str() ); } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 2be6ef02c..e73655c44 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -1782,7 +1782,7 @@ fn test_du_long_path_safe_traversal() { at.mkdir(&deep_path); for i in 0..15 { - let long_dir_name = format!("{}{}", "a".repeat(100), i); + let long_dir_name = format!("{}{i}", "a".repeat(100)); deep_path = format!("{deep_path}/{long_dir_name}"); at.mkdir_all(&deep_path); } @@ -1830,7 +1830,7 @@ fn test_du_safe_traversal_with_symlinks() { at.mkdir(&deep_path); for i in 0..8 { - let dir_name = format!("{}{}", "b".repeat(50), i); + let dir_name = format!("{}{i}", "b".repeat(50)); deep_path = format!("{deep_path}/{dir_name}"); at.mkdir_all(&deep_path); } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 41b72af6b..56215eac4 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -4785,8 +4785,8 @@ fn test_ls_selinux_context_indicator() { // The 11th character (0-indexed position 10) should be "." for SELinux context assert_eq!( chars[10], '.', - "Expected '.' indicator for SELinux context in position 11, got '{}' in line: {}", - chars[10], first_line + "Expected '.' indicator for SELinux context in position 11, got '{}' in line: {first_line}", + chars[10], ); } diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index 0756cb5d6..231fe3495 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -468,9 +468,7 @@ fn test_selinux() { let context_value = get_getfattr_output(&at.plus_as_string(dest)); assert!( context_value.contains("unconfined_u"), - "Expected '{}' not found in getfattr output:\n{}", - "unconfined_u", - context_value + "Expected 'unconfined_u' not found in getfattr output:\n{context_value}", ); at.rmdir(dest); } diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index c303a4bab..3d2f1df5e 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -1103,7 +1103,7 @@ fn test_rm_recursive_long_path_safe_traversal() { at.mkdir(&deep_path); for i in 0..12 { - let long_dir_name = format!("{}{}", "z".repeat(80), i); + let long_dir_name = format!("{}{i}", "z".repeat(80)); deep_path = format!("{deep_path}/{long_dir_name}"); at.mkdir_all(&deep_path); } diff --git a/tests/test_uudoc.rs b/tests/test_uudoc.rs index b4f12c099..a1e32f484 100644 --- a/tests/test_uudoc.rs +++ b/tests/test_uudoc.rs @@ -62,10 +62,8 @@ fn get_doc_file_from_output(output: &str) -> (String, String) { Ok(content) => content, Err(e) => { panic!( - "Failed to read file {}: {} from {:?}", - correct_path_test, - e, - env::current_dir() + "Failed to read file {correct_path_test}: {e} from {:?}", + env::current_dir(), ); } };