Closed Bug 1396515 Opened 3 years ago Closed 3 years ago

Fix wrong && and || operators indentation

Categories

(Core :: Audio/Video: Playback, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: jya, Assigned: jya)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Over the year, we had changed the formatting of logical expression containing || and && to go from:

if (a &&
    b)

to:
if (a
    && b)

this stemmed from a misreading of the coding style:
"Overlong expressions not joined by && and || should break so the operator starts on the second line and starts in the same column as the start of the expression in the first line. This applies to ?:, binary arithmetic operators including +, and member-of operators (in particular the . operator in JavaScript, see the Rationale)."

*not* joined by && and || is the keypard.

So all are to be broken with the operator put at the front, except && and ||
See Also: → 1338105
I think we should run `mach clang-format` before landing a patch even if it is not 100% compatible with the Gecko coding style. Btw, what is clang-format's opinion about the position of && or ||?
Comment on attachment 8904194 [details]
Bug 1396515: Fix incorrect && and || operator placements.

https://reviewboard.mozilla.org/r/175956/#review181170
Attachment #8904194 - Flags: review?(sledru) → review+
Pushed by jyavenard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c884cca7be4a
Fix incorrect && and || operator placements. r=sylvestre
https://hg.mozilla.org/mozilla-central/rev/c884cca7be4a
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.