Closed Bug 1626762 Opened 5 years ago Closed 5 years ago

nsPSPrinters.cpp: do not use 'else' after 'return'

Categories

(Developer Infrastructure :: Source Code Analysis, task)

task
Not set
minor

Tracking

(firefox77 fixed)

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: Sylvestre, Assigned: ryan.pauls67, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=C++])

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1626761 +++

Filling as a good first bug to learn workflows.

  if (StringBeginsWith(aName, NS_LITERAL_CSTRING(NS_POSTSCRIPT_DRIVER_NAME)))
    return kTypePS;
  else if (StringBeginsWith(aName, NS_LITERAL_CSTRING(NS_CUPS_PRINTER)))
    return kTypeCUPS;
  else
    return kTypeUnknown;

do not use 'else' after 'return'

please also note that { } should be added (even for one line)

https://searchfox.org/mozilla-central/source/widget/gtk/nsPSPrinters.cpp#103-108

As the change is pretty easy, it is mostly to learn how to contribute to Firefox.

Found by http://clang.llvm.org/extra/clang-tidy/checks/readability-else-after-return.html

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/tools/docs/contribute/how_to_contribute_firefox.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Assignee: nobody → ryan.pauls67
Status: NEW → ASSIGNED
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/960689967110 Removed the else statement to improve readability and better meet guidelines as per http://clang.llvm.org/extra/clang-tidy/checks/readability-else-after-return.html r=sylvestre
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: