mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 21:43:52 +00:00
Format PatternMatchSingleton
(#6741)
This commit is contained in:
parent
fa32cd9b6f
commit
0f9ccfcad9
4 changed files with 63 additions and 8 deletions
|
@ -1,13 +1,18 @@
|
|||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::PatternMatchSingleton;
|
||||
use crate::prelude::*;
|
||||
use ruff_python_ast::{Constant, PatternMatchSingleton};
|
||||
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use crate::{FormatNodeRule, PyFormatter};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatPatternMatchSingleton;
|
||||
|
||||
impl FormatNodeRule<PatternMatchSingleton> for FormatPatternMatchSingleton {
|
||||
fn fmt_fields(&self, item: &PatternMatchSingleton, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented_custom_text("None", item)])
|
||||
match item.value {
|
||||
Constant::None => text("None").fmt(f),
|
||||
Constant::Bool(true) => text("True").fmt(f),
|
||||
Constant::Bool(false) => text("False").fmt(f),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue