Skip to content

Commit

Permalink
Compiler panic?
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Aug 16, 2023
1 parent 897cce8 commit 41caad1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,14 @@ def foo():
no_comments
):
pass

match pattern_comments:
case value:
pass
# leading comment
case value1:
pass
case value2: # trailing
pass
case value3:
pass
14 changes: 6 additions & 8 deletions crates/ruff_python_formatter/src/pattern/pattern_match_value.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
use ruff_formatter::{write, Buffer, FormatResult};
use ruff_python_ast::PatternMatchValue;

use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
use crate::{AsFormat, FormatNodeRule, PyFormatter};

#[derive(Default)]
pub struct FormatPatternMatchValue;

impl FormatNodeRule<PatternMatchValue> for FormatPatternMatchValue {
fn fmt_fields(&self, item: &PatternMatchValue, f: &mut PyFormatter) -> FormatResult<()> {
write!(
f,
[not_yet_implemented_custom_text(
"\"NOT_YET_IMPLEMENTED_PatternMatchValue\"",
item
)]
)
let PatternMatchValue { value, .. } = item;

let formatted = value.format();

write!(f, [formatted])
}
}

0 comments on commit 41caad1

Please sign in to comment.