use short-circuit where possible#73
Conversation
|
Added a second commit that prefers membership test. |
t-14
left a comment
There was a problem hiding this comment.
Please remove code reformatting, and preserve formatting logic in sections that are being refactored.
|
|
||
| if Set = Charset_US_ASCII then | ||
| Encoding := Encoding_7bit; | ||
| elsif Set = Charset_ISO_8859_1 |
There was a problem hiding this comment.
How would you want this code to be rewritten?
given that you want remove code reformatting, and preserve formatting logic in sections that are being refactored.
Note that the newly rewritten code must be pretty printed,
since otherwise the rewritten code might violate style rules (as specified in the project file).
There was a problem hiding this comment.
In this case a too long line is certainly possible ;-)
There was a problem hiding this comment.
I am referring to places where reformatting is not motivated by anything, like gnatcoll-memory.adb:291
There was a problem hiding this comment.
How would you want this code to be rewritten?
In this specific case, try to keep the same terms on each line as it was previously. We used to have one line for latin-3 and another for latin-4, your patch reformats it so references to latin-4 are on two different lines, this harms readability.
There was a problem hiding this comment.
You did however not turn off pretty printing,
so running the pretty printer might have changed your constraints.
It is an automated change, but it is a nice case of requirements for rewriting existing code.
There was a problem hiding this comment.
You did however not turn off pretty printing,
I don't understand. "turn off pretty printing" where? gnatcoll is obviously hand-formatted.
Dear Gnatcoll developers,
According to adaic
short circuit operators should be preferred.
However, in case of side effects in the second/right argument the replacement is NOT equivalent.
The rejuvenation library has detected where logical operators can be replaced by short-circuit ones
and replaced them.
Greetings,
Pierre
Problem detected and solved by Rejuvenation-Ada crate
