Use write!(…)
This commit is contained in:
@@ -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>")
|
||||
|
||||
Reference in New Issue
Block a user