Fix ArgWithDefault comments handling (#5204)

This commit is contained in:
Micha Reiser 2023-06-20 22:48:07 +02:00 committed by GitHub
parent fde5dbc9aa
commit e520a3a721
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 73 additions and 69 deletions

View file

@ -411,10 +411,12 @@ Formatted twice:
#[test]
fn quick_test() {
let src = r#"
def test(): ...
# Comment
def with_leading_comment(): ...
def foo(
b=3
+ 2 # comment
):
...
"#;
// Tokenize once
let mut tokens = Vec::new();
@ -437,10 +439,10 @@ def with_leading_comment(): ...
// Use `dbg_write!(f, []) instead of `write!(f, [])` in your formatting code to print some IR
// inside of a `Format` implementation
// use ruff_formatter::FormatContext;
// formatted
// dbg!(formatted
// .document()
// .display(formatted.context().source_code());
// .display(formatted.context().source_code()));
//
// dbg!(formatted
// .context()
// .comments()