1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Replace backtick quoting

This commit is contained in:
Jan Verbeek 2021-09-07 20:15:30 +02:00
parent 918603909b
commit 1ef2574b08
4 changed files with 10 additions and 10 deletions

View file

@ -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
}

View file

@ -133,7 +133,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
fmt_opts.width = match s.parse::<usize>() {
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::<usize>() {
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::<usize>() {
Ok(t) => t,
Err(e) => {
crash!(1, "Invalid TABWIDTH specification: `{}': {}", s, e);
crash!(1, "Invalid TABWIDTH specification: {}: {}", s.quote(), e);
}
};
};

View file

@ -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)

View file

@ -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]