ruff_python_formatter 0.0.5

This is an internal component crate of Ruff
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::prelude::*;
use ruff_formatter::write;
use ruff_python_ast::PatternKeyword;

#[derive(Default)]
pub struct FormatPatternKeyword;

impl FormatNodeRule<PatternKeyword> for FormatPatternKeyword {
    fn fmt_fields(&self, item: &PatternKeyword, f: &mut PyFormatter) -> FormatResult<()> {
        let PatternKeyword {
            range: _,
            node_index: _,
            attr,
            pattern,
        } = item;
        write!(f, [attr.format(), token("="), pattern.format()])
    }
}