mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-21 19:05:09 +00:00
Format class
definitions (#5289)
This commit is contained in:
parent
7d4f8e59da
commit
f7e1cf4b51
27 changed files with 914 additions and 541 deletions
|
@ -582,6 +582,12 @@ fn handle_trailing_end_of_line_condition_comment<'a>(
|
|||
.as_deref()
|
||||
.map(AnyNodeRef::from)
|
||||
.or_else(|| Some(AnyNodeRef::from(args.as_ref()))),
|
||||
AnyNodeRef::StmtClassDef(StmtClassDef {
|
||||
bases, keywords, ..
|
||||
}) => keywords
|
||||
.last()
|
||||
.map(AnyNodeRef::from)
|
||||
.or_else(|| bases.last().map(AnyNodeRef::from)),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
|
@ -622,8 +628,13 @@ fn handle_trailing_end_of_line_condition_comment<'a>(
|
|||
TokenKind::RParen => {
|
||||
// Skip over any closing parentheses
|
||||
}
|
||||
_ => {
|
||||
unreachable!("Only ')' or ':' should follow the condition")
|
||||
TokenKind::Comma => {
|
||||
// Skip over any trailing comma
|
||||
}
|
||||
kind => {
|
||||
unreachable!(
|
||||
"Only ')' or ':' should follow the condition but encountered {kind:?}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue