Use write!(…)

This commit is contained in:
David Peter
2025-02-20 08:25:21 +01:00
parent 50e9e1c3fa
commit 6dd540248e

View File

@@ -89,19 +89,19 @@ impl Display for DisplayRepresentation<'_> {
Type::KnownInstance(known_instance) => f.write_str(known_instance.repr(self.db)),
Type::FunctionLiteral(function) => f.write_str(function.name(self.db)),
Type::Callable(CallableType::BoundMethod(bound_method)) => {
f.write_str("<bound method `")?;
f.write_str(bound_method.function(self.db).name(self.db))?;
f.write_str("` of `")?;
bound_method
.self_instance(self.db)
.display(self.db)
.fmt(f)?;
f.write_str("`>")
write!(
f,
"<bound method `{method}` of `{instance}`>",
method = bound_method.function(self.db).name(self.db),
instance = bound_method.self_instance(self.db).display(self.db)
)
}
Type::Callable(CallableType::MethodWrapperDunderGet(function)) => {
f.write_str("<method-wrapper `__get__` of `")?;
f.write_str(function.name(self.db))?;
f.write_str("`>")
write!(
f,
"<method-wrapper `__get__` of `{function}`>",
function = function.name(self.db)
)
}
Type::Callable(CallableType::WrapperDescriptorDunderGet) => {
f.write_str("<wrapper-descriptor `__get__` of `function` objects>")