mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-18 01:20:40 +00:00
Format Function definitions (#4951)
This commit is contained in:
parent
07cc4bcb0f
commit
68969240c5
79 changed files with 2601 additions and 1223 deletions
|
@ -112,3 +112,22 @@ impl<'a> From<&'a StmtAsyncFunctionDef> for AnyFunctionDefinition<'a> {
|
|||
Self::AsyncFunctionDefinition(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<AnyFunctionDefinition<'a>> for AnyNodeRef<'a> {
|
||||
fn from(value: AnyFunctionDefinition<'a>) -> Self {
|
||||
match value {
|
||||
AnyFunctionDefinition::FunctionDefinition(function_def) => {
|
||||
AnyNodeRef::StmtFunctionDef(function_def)
|
||||
}
|
||||
AnyFunctionDefinition::AsyncFunctionDefinition(async_def) => {
|
||||
AnyNodeRef::StmtAsyncFunctionDef(async_def)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a AnyFunctionDefinition<'a>> for AnyNodeRef<'a> {
|
||||
fn from(value: &'a AnyFunctionDefinition<'a>) -> Self {
|
||||
(*value).into()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue