Skip to content

Commit cbc2e27

Browse files
Compiler panic?
1 parent e28858b commit cbc2e27

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/match.py

+11
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,14 @@ def foo():
141141
no_comments
142142
):
143143
pass
144+
145+
match pattern_comments:
146+
case value:
147+
pass
148+
# leading comment
149+
case value1:
150+
pass
151+
case value2: # trailing
152+
pass
153+
case value3:
154+
pass
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
use ruff_formatter::{write, Buffer, FormatResult};
22
use ruff_python_ast::PatternMatchValue;
33

4-
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
4+
use crate::{AsFormat, FormatNodeRule, PyFormatter};
55

66
#[derive(Default)]
77
pub struct FormatPatternMatchValue;
88

99
impl FormatNodeRule<PatternMatchValue> for FormatPatternMatchValue {
1010
fn fmt_fields(&self, item: &PatternMatchValue, f: &mut PyFormatter) -> FormatResult<()> {
11-
write!(
12-
f,
13-
[not_yet_implemented_custom_text(
14-
"\"NOT_YET_IMPLEMENTED_PatternMatchValue\"",
15-
item
16-
)]
17-
)
11+
let PatternMatchValue { value, .. } = item;
12+
13+
let formatted = value.format();
14+
15+
write!(f, [formatted])
1816
}
1917
}

0 commit comments

Comments
 (0)