mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 06:58:36 +02:00
Fix easy clippy lints from latest stable (#16053)
1.88.0 was released today, clippy now lints (machine-applicable) against: - format strings with empty braces that could be inlined - easy win - `manual_abs_diff` - returning of a stored result of the last expression. - this can be somewhat contentious but touched only a few places
This commit is contained in:
committed by
GitHub
parent
372d576846
commit
9da0f41ebb
@ -51,18 +51,18 @@ impl SimplePluginCommand for FromPlist {
|
||||
match input {
|
||||
NuValue::String { val, .. } => {
|
||||
let plist = plist::from_bytes(val.as_bytes())
|
||||
.map_err(|e| build_label_error(format!("{}", e), input.span()))?;
|
||||
.map_err(|e| build_label_error(format!("{e}"), input.span()))?;
|
||||
let converted = convert_plist_value(&plist, call.head)?;
|
||||
Ok(converted)
|
||||
}
|
||||
NuValue::Binary { val, .. } => {
|
||||
let plist = plist::from_bytes(val)
|
||||
.map_err(|e| build_label_error(format!("{}", e), input.span()))?;
|
||||
.map_err(|e| build_label_error(format!("{e}"), input.span()))?;
|
||||
let converted = convert_plist_value(&plist, call.head)?;
|
||||
Ok(converted)
|
||||
}
|
||||
_ => Err(build_label_error(
|
||||
format!("Invalid input, must be string not: {:?}", input),
|
||||
format!("Invalid input, must be string not: {input:?}"),
|
||||
call.head,
|
||||
)),
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ impl SimplePluginCommand for IntoPlist {
|
||||
let mut out = Vec::new();
|
||||
if call.has_flag("binary")? {
|
||||
plist::to_writer_binary(&mut out, &plist_val)
|
||||
.map_err(|e| build_label_error(format!("{}", e), input.span()))?;
|
||||
.map_err(|e| build_label_error(format!("{e}"), input.span()))?;
|
||||
Ok(NuValue::binary(out, input.span()))
|
||||
} else {
|
||||
plist::to_writer_xml(&mut out, &plist_val)
|
||||
.map_err(|e| build_label_error(format!("{}", e), input.span()))?;
|
||||
.map_err(|e| build_label_error(format!("{e}"), input.span()))?;
|
||||
Ok(NuValue::string(
|
||||
String::from_utf8(out)
|
||||
.map_err(|e| build_label_error(format!("{}", e), input.span()))?,
|
||||
.map_err(|e| build_label_error(format!("{e}"), input.span()))?,
|
||||
input.span(),
|
||||
))
|
||||
}
|
||||
@ -77,7 +77,7 @@ fn convert_nu_value(nu_val: &NuValue) -> Result<PlistValue, LabeledError> {
|
||||
NuValue::Date { val, .. } => Ok(PlistValue::Date(SystemTime::from(val.to_owned()).into())),
|
||||
NuValue::Filesize { val, .. } => Ok(PlistValue::Integer(val.get().into())),
|
||||
_ => Err(build_label_error(
|
||||
format!("{:?} is not convertible", nu_val),
|
||||
format!("{nu_val:?} is not convertible"),
|
||||
span,
|
||||
)),
|
||||
}
|
||||
|
Reference in New Issue
Block a user