diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 240b5eafe..40799d009 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -150,7 +150,7 @@ fn set_context(root: &Path, options: &clap::ArgMatches) { Some(u) => { let s: Vec<&str> = u.split(':').collect(); if s.len() != 2 || s.iter().any(|&spec| spec.is_empty()) { - crash!(1, "invalid userspec: `{}`", u) + crash!(1, "invalid userspec: {}", u.quote()) }; s } diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index df5d971e5..669c98b14 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -133,7 +133,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fmt_opts.width = match s.parse::() { Ok(t) => t, Err(e) => { - crash!(1, "Invalid WIDTH specification: `{}': {}", s, e); + crash!(1, "Invalid WIDTH specification: {}: {}", s.quote(), e); } }; if fmt_opts.width > MAX_WIDTH { @@ -150,7 +150,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fmt_opts.goal = match s.parse::() { Ok(t) => t, Err(e) => { - crash!(1, "Invalid GOAL specification: `{}': {}", s, e); + crash!(1, "Invalid GOAL specification: {}: {}", s.quote(), e); } }; if !matches.is_present(OPT_WIDTH) { @@ -164,7 +164,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fmt_opts.tabwidth = match s.parse::() { Ok(t) => t, Err(e) => { - crash!(1, "Invalid TABWIDTH specification: `{}': {}", s, e); + crash!(1, "Invalid TABWIDTH specification: {}: {}", s.quote(), e); } }; }; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index bab6dd770..c8a429e53 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -767,19 +767,19 @@ impl KeyPosition { let field = field_and_char .next() - .ok_or_else(|| format!("invalid key `{}`", key))?; + .ok_or_else(|| format!("invalid key {}", key.quote()))?; let char = field_and_char.next(); let field = field .parse() - .map_err(|e| format!("failed to parse field index `{}`: {}", field, e))?; + .map_err(|e| format!("failed to parse field index {}: {}", field.quote(), e))?; if field == 0 { return Err("field index can not be 0".to_string()); } let char = char.map_or(Ok(default_char_index), |char| { char.parse() - .map_err(|e| format!("failed to parse character index `{}`: {}", char, e)) + .map_err(|e| format!("failed to parse character index {}: {}", char.quote(), e)) })?; Ok(Self { @@ -890,7 +890,7 @@ impl FieldSelector { 'R' => key_settings.set_sort_mode(SortMode::Random)?, 'r' => key_settings.reverse = true, 'V' => key_settings.set_sort_mode(SortMode::Version)?, - c => return Err(format!("invalid option: `{}`", c)), + c => return Err(format!("invalid option: '{}'", c)), } } Ok(ignore_blanks) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index b389c9011..2aa26ad24 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -531,7 +531,7 @@ fn test_keys_invalid_field() { new_ucmd!() .args(&["-k", "1."]) .fails() - .stderr_only("sort: failed to parse key '1.': failed to parse character index ``: cannot parse integer from empty string"); + .stderr_only("sort: failed to parse key '1.': failed to parse character index '': cannot parse integer from empty string"); } #[test] @@ -539,7 +539,7 @@ fn test_keys_invalid_field_option() { new_ucmd!() .args(&["-k", "1.1x"]) .fails() - .stderr_only("sort: failed to parse key '1.1x': invalid option: `x`"); + .stderr_only("sort: failed to parse key '1.1x': invalid option: 'x'"); } #[test]