Fix nightly clippy warnings

This commit is contained in:
Jeong YunWon 2023-01-07 20:14:24 +09:00
parent 2dfd053bed
commit 509cf7ed0d
2 changed files with 4 additions and 4 deletions

View file

@ -46,7 +46,7 @@ impl std::fmt::Display for Constant {
Constant::Int(i) => i.fmt(f), Constant::Int(i) => i.fmt(f),
Constant::Tuple(tup) => { Constant::Tuple(tup) => {
if let [elt] = &**tup { if let [elt] = &**tup {
write!(f, "({},)", elt) write!(f, "({elt},)")
} else { } else {
f.write_str("(")?; f.write_str("(")?;
for (i, elt) in tup.iter().enumerate() { for (i, elt) in tup.iter().enumerate() {
@ -61,9 +61,9 @@ impl std::fmt::Display for Constant {
Constant::Float(fp) => f.pad(&rustpython_common::float_ops::to_string(*fp)), Constant::Float(fp) => f.pad(&rustpython_common::float_ops::to_string(*fp)),
Constant::Complex { real, imag } => { Constant::Complex { real, imag } => {
if *real == 0.0 { if *real == 0.0 {
write!(f, "{}j", imag) write!(f, "{imag}j")
} else { } else {
write!(f, "({}{:+}j)", real, imag) write!(f, "({real}{imag:+}j)")
} }
} }
Constant::Ellipsis => f.pad("..."), Constant::Ellipsis => f.pad("..."),

View file

@ -400,7 +400,7 @@ impl<'a> Unparser<'a> {
.checked_sub(defaults_start) .checked_sub(defaults_start)
.and_then(|i| args.kw_defaults.get(i)) .and_then(|i| args.kw_defaults.get(i))
{ {
write!(self, "={}", default)?; write!(self, "={default}")?;
} }
} }
if let Some(kwarg) = &args.kwarg { if let Some(kwarg) = &args.kwarg {