mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-02 01:42:25 +00:00
Rename Parameter#arg
and ParameterWithDefault#def
fields (#6255)
## Summary This PR renames... - `Parameter#arg` to `Parameter#name` - `ParameterWithDefault#def` to `ParameterWithDefault#parameter` (such that `ParameterWithDefault` has a `default` and a `parameter`) ## Test Plan `cargo test`
This commit is contained in:
parent
adc8bb7821
commit
9c708d8fc1
56 changed files with 268 additions and 260 deletions
|
@ -10,11 +10,11 @@ impl FormatNodeRule<Parameter> for FormatParameter {
|
|||
fn fmt_fields(&self, item: &Parameter, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
let Parameter {
|
||||
range: _,
|
||||
arg,
|
||||
name,
|
||||
annotation,
|
||||
} = item;
|
||||
|
||||
arg.format().fmt(f)?;
|
||||
name.format().fmt(f)?;
|
||||
|
||||
if let Some(annotation) = annotation {
|
||||
write!(f, [text(":"), space(), annotation.format()])?;
|
||||
|
|
|
@ -11,14 +11,14 @@ impl FormatNodeRule<ParameterWithDefault> for FormatParameterWithDefault {
|
|||
fn fmt_fields(&self, item: &ParameterWithDefault, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
let ParameterWithDefault {
|
||||
range: _,
|
||||
def,
|
||||
parameter,
|
||||
default,
|
||||
} = item;
|
||||
|
||||
write!(f, [def.format()])?;
|
||||
write!(f, [parameter.format()])?;
|
||||
|
||||
if let Some(default) = default {
|
||||
let space = def.annotation.is_some().then_some(space());
|
||||
let space = parameter.annotation.is_some().then_some(space());
|
||||
write!(f, [space, text("="), space, group(&default.format())])?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue