mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 15:07:47 +00:00
refactor/polish ~ fix cargo clippy
complaints (unneeded format
)
This commit is contained in:
parent
3bff70967c
commit
25b1f98cf8
4 changed files with 7 additions and 9 deletions
|
@ -979,7 +979,7 @@ fn copy_attribute(source: &Path, dest: &Path, attribute: &Attribute) -> CopyResu
|
|||
}
|
||||
#[cfg(not(unix))]
|
||||
{
|
||||
return Err(format!("XAttrs are only supported on unix.").into());
|
||||
return Err("XAttrs are only supported on unix.".to_string().into());
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1114,7 +1114,7 @@ fn copy_file(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> {
|
|||
fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> {
|
||||
if options.reflink {
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
return Err(format!("--reflink is only supported on linux").into());
|
||||
return Err("--reflink is only supported on linux".to_string().into());
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
|
|
|
@ -224,7 +224,7 @@ impl OdOptions {
|
|||
let formats = match parse_format_flags(&args) {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
return Err(format!("{}", e));
|
||||
return Err(e.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -260,7 +260,7 @@ impl OdOptions {
|
|||
Some(s) => {
|
||||
let st = s.into_bytes();
|
||||
if st.len() != 1 {
|
||||
return Err(format!("Radix must be one of [d, o, n, x]"));
|
||||
return Err("Radix must be one of [d, o, n, x]".to_string());
|
||||
} else {
|
||||
let radix: char =
|
||||
*(st.get(0).expect("byte string of length 1 lacks a 0th elem")) as char;
|
||||
|
@ -269,7 +269,7 @@ impl OdOptions {
|
|||
'x' => Radix::Hexadecimal,
|
||||
'o' => Radix::Octal,
|
||||
'n' => Radix::NoPrefix,
|
||||
_ => return Err(format!("Radix must be one of [d, o, n, x]")),
|
||||
_ => return Err("Radix must be one of [d, o, n, x]".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,9 +155,7 @@ pub fn parse_format_flags(args: &Vec<String>) -> Result<Vec<ParsedFormatterItemI
|
|||
}
|
||||
}
|
||||
if expect_type_string {
|
||||
return Err(format!(
|
||||
"missing format specification after '--format' / '-t'"
|
||||
));
|
||||
return Err("missing format specification after '--format' / '-t'".to_string());
|
||||
}
|
||||
|
||||
if formats.is_empty() {
|
||||
|
|
|
@ -271,7 +271,7 @@ fn get_reference(config: &Config, word_ref: &WordRef, line: &str) -> String {
|
|||
Some(x) => (x.start(), x.end()),
|
||||
None => (0, 0),
|
||||
};
|
||||
format!("{}", &line[beg..end])
|
||||
line[beg..end].to_string()
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue