Skip to content

Commit

Permalink
Remove unused AsFormat trait for Option<T> (#3041)
Browse files Browse the repository at this point in the history
We should re-add this, but it's currently unused and doesn't compile under 1.66.0.

See: #3039.
  • Loading branch information
charliermarsh committed Feb 19, 2023
1 parent d6a1000 commit c297d46
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions crates/ruff_python_formatter/src/shared_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ where
}
}

/// Implement [`AsFormat`] for [`Option`] when `T` implements [`AsFormat`]
///
/// Allows to call format on optional AST fields without having to unwrap the
/// field first.
impl<T, C> AsFormat<C> for Option<T>
where
T: AsFormat<C>,
{
type Format<'a> = Option<T::Format<'a>> where Self: 'a;

fn format(&self) -> Self::Format<'_> {
self.as_ref().map(AsFormat::format)
}
}

/// Used to convert this object into an object that can be formatted.
///
/// The difference to [`AsFormat`] is that this trait takes ownership of `self`.
Expand Down

0 comments on commit c297d46

Please sign in to comment.