Use variable interpolation for println!.

This commit is contained in:
Stephen Chung
2022-10-27 13:38:21 +08:00
parent 6b24cc151e
commit 3c2e031883
24 changed files with 132 additions and 150 deletions

View File

@@ -465,13 +465,13 @@ impl fmt::Debug for Expr {
let mut display_pos = format!(" @ {:?}", self.start_position());
match self {
Self::DynamicConstant(value, ..) => write!(f, "{:?}", value),
Self::BoolConstant(value, ..) => write!(f, "{:?}", value),
Self::IntegerConstant(value, ..) => write!(f, "{:?}", value),
Self::DynamicConstant(value, ..) => write!(f, "{value:?}"),
Self::BoolConstant(value, ..) => write!(f, "{value:?}"),
Self::IntegerConstant(value, ..) => write!(f, "{value:?}"),
#[cfg(not(feature = "no_float"))]
Self::FloatConstant(value, ..) => write!(f, "{:?}", value),
Self::CharConstant(value, ..) => write!(f, "{:?}", value),
Self::StringConstant(value, ..) => write!(f, "{:?}", value),
Self::FloatConstant(value, ..) => write!(f, "{value:?}"),
Self::CharConstant(value, ..) => write!(f, "{value:?}"),
Self::StringConstant(value, ..) => write!(f, "{value:?}"),
Self::Unit(..) => f.write_str("()"),
Self::InterpolatedString(x, ..) => {
@@ -502,10 +502,10 @@ impl fmt::Debug for Expr {
f.write_str(&x.3)?;
#[cfg(not(feature = "no_module"))]
if let Some(n) = x.1.index() {
write!(f, " #{}", n)?;
write!(f, " #{n}")?;
}
if let Some(n) = i.map_or_else(|| x.0, |n| NonZeroUsize::new(n.get() as usize)) {
write!(f, " #{}", n)?;
write!(f, " #{n}")?;
}
f.write_str(")")
}

View File

@@ -37,7 +37,7 @@ impl fmt::Debug for Namespace {
}
if let Some(index) = self.index {
write!(f, "{} -> ", index)?;
write!(f, "{index} -> ")?;
}
f.write_str(

View File

@@ -185,8 +185,8 @@ impl fmt::Debug for RangeCase {
#[inline(never)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ExclusiveInt(r, n) => write!(f, "{}..{} => {}", r.start, r.end, n),
Self::InclusiveInt(r, n) => write!(f, "{}..={} => {}", *r.start(), *r.end(), n),
Self::ExclusiveInt(r, n) => write!(f, "{}..{} => {n}", r.start, r.end),
Self::InclusiveInt(r, n) => write!(f, "{}..={} => {n}", *r.start(), *r.end()),
}
}
}