File tree 2 files changed +17
-8
lines changed
crates/ruff_python_formatter
resources/test/fixtures/ruff/statement
2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -141,3 +141,14 @@ def foo():
141
141
no_comments
142
142
):
143
143
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 number Diff line number Diff line change 1
1
use ruff_formatter:: { write, Buffer , FormatResult } ;
2
2
use ruff_python_ast:: PatternMatchValue ;
3
3
4
- use crate :: { not_yet_implemented_custom_text , FormatNodeRule , PyFormatter } ;
4
+ use crate :: { AsFormat , FormatNodeRule , PyFormatter } ;
5
5
6
6
#[ derive( Default ) ]
7
7
pub struct FormatPatternMatchValue ;
8
8
9
9
impl FormatNodeRule < PatternMatchValue > for FormatPatternMatchValue {
10
10
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] )
18
16
}
19
17
}
You can’t perform that action at this time.
0 commit comments