Use write_str.

This commit is contained in:
Stephen Chung 2021-06-04 14:23:40 +08:00
parent e35122ae5d
commit 3371eed411
3 changed files with 3 additions and 3 deletions

View File

@ -1776,7 +1776,7 @@ impl fmt::Debug for Expr {
Some((_, ref namespace)) => write!(f, "{}", namespace)?,
_ => (),
}
write!(f, "{}", x.2)?;
f.write_str(&x.2)?;
match i.map_or_else(|| x.0, |n| NonZeroUsize::new(n.get() as usize)) {
Some(n) => write!(f, ", {}", n)?,
_ => (),

View File

@ -692,7 +692,7 @@ impl fmt::Debug for Dynamic {
return fmt::Debug::fmt(_value_any.downcast_ref::<i128>().expect(CHECKED), f);
}
write!(f, "{}", value.type_name())
f.write_str(value.type_name())
}
#[cfg(not(feature = "no_closure"))]

View File

@ -172,7 +172,7 @@ impl fmt::Display for EvalAltResult {
Self::ErrorModuleNotFound(s, _) => write!(f, "{}: '{}'", desc, s)?,
Self::ErrorDotExpr(s, _) if !s.is_empty() => write!(f, "{}", s)?,
Self::ErrorDotExpr(s, _) if !s.is_empty() => f.write_str(s)?,
Self::ErrorIndexingType(s, _) => write!(f, "Indexer not registered for type '{}'", s)?,