mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Introduce SourceCodeSlice
to reduce the size of FormatElement
(#4622)
Introduce `SourceCodeSlice` to reduce the size of `FormatElement`
This commit is contained in:
parent
6943beee66
commit
86ced3516b
26 changed files with 408 additions and 171 deletions
|
@ -11,7 +11,7 @@ pub struct FormatExcepthandler<'a> {
|
|||
item: &'a Excepthandler,
|
||||
}
|
||||
|
||||
impl AsFormat<ASTFormatContext> for Excepthandler {
|
||||
impl AsFormat<ASTFormatContext<'_>> for Excepthandler {
|
||||
type Format<'a> = FormatExcepthandler<'a>;
|
||||
|
||||
fn format(&self) -> Self::Format<'_> {
|
||||
|
@ -19,7 +19,7 @@ impl AsFormat<ASTFormatContext> for Excepthandler {
|
|||
}
|
||||
}
|
||||
|
||||
impl Format<ASTFormatContext> for FormatExcepthandler<'_> {
|
||||
impl Format<ASTFormatContext<'_>> for FormatExcepthandler<'_> {
|
||||
fn fmt(&self, f: &mut Formatter<ASTFormatContext>) -> FormatResult<()> {
|
||||
let excepthandler = self.item;
|
||||
let ExcepthandlerKind::ExceptHandler { type_, name, body } = &excepthandler.node;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue