fables-tales / rubyfmt

Ruby Autoformatter!
MIT License
1.07k stars 50 forks source link

Fix rendering of single-item massigns for rest params #393

Closed reese closed 1 year ago

reese commented 1 year ago

Resolves #392

For massigns, we have special handling for the case where the massign is only one item, e.g. foo, = [1, 2], since that comma produces different behavior at runtime. However, Ruby also considers *foo = [1, 2] an massign, even though there's only one item and no comma. Ruby also doesn't consider *foo, = [1, 2] valid syntax, so we shouldn't render that final comma when the only item in an massign is a rest param.