mirror of
https://github.com/astral-sh/ruff.git
synced 2025-12-04 00:55:14 +00:00
Implement IntoFormat for &T (#4781)
This commit is contained in:
parent
4ea4fd1984
commit
5f4bce6d2b
1 changed files with 12 additions and 0 deletions
|
|
@ -44,6 +44,18 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Implement [`IntoFormat`] for references to types that implement [`AsFormat`].
|
||||||
|
impl<'a, T, C> IntoFormat<C> for &'a T
|
||||||
|
where
|
||||||
|
T: AsFormat<C>,
|
||||||
|
{
|
||||||
|
type Format = T::Format<'a>;
|
||||||
|
|
||||||
|
fn into_format(self) -> Self::Format {
|
||||||
|
AsFormat::format(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Formatting specific [`Iterator`] extensions
|
/// Formatting specific [`Iterator`] extensions
|
||||||
pub trait FormattedIterExt {
|
pub trait FormattedIterExt {
|
||||||
/// Converts every item to an object that knows how to format it.
|
/// Converts every item to an object that knows how to format it.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue