Skip to content

Commit 6f0153f

Browse files
committed
Avoid else after return for simple cases.
1 parent 7bc1801 commit 6f0153f

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

lexlib/Accessor.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,5 @@ int Accessor::IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfn
7272
if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
7373
(pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
7474
return indent | SC_FOLDLEVELWHITEFLAG;
75-
else
76-
return indent;
75+
return indent;
7776
}

lexlib/CharacterCategory.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4285,18 +4285,16 @@ bool IsIdContinue(int character) noexcept {
42854285
bool IsXidStart(int character) noexcept {
42864286
if (OmitXidStart(character)) {
42874287
return false;
4288-
} else {
4289-
return IsIdStart(character);
42904288
}
4289+
return IsIdStart(character);
42914290
}
42924291

42934292
// XID_Continue is ID_Continue modified for Normalization Form KC in UAX #31
42944293
bool IsXidContinue(int character) noexcept {
42954294
if (OmitXidContinue(character)) {
42964295
return false;
4297-
} else {
4298-
return IsIdContinue(character);
42994296
}
4297+
return IsIdContinue(character);
43004298
}
43014299

43024300
CharacterCategoryMap::CharacterCategoryMap() {

lexlib/LexerBase.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ const char * SCI_METHOD LexerBase::DescribeProperty(const char *) {
6565
Sci_Position SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) {
6666
if (props.Set(key, val)) {
6767
return 0;
68-
} else {
69-
return -1;
7068
}
69+
return -1;
7170
}
7271

7372
const char *SCI_METHOD LexerBase::PropertyGet(const char *key) {

lexlib/LexerModule.cxx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,22 @@ int LexerModule::GetLanguage() const noexcept {
6363
int LexerModule::GetNumWordLists() const noexcept {
6464
if (!wordListDescriptions) {
6565
return -1;
66-
} else {
67-
int numWordLists = 0;
68-
69-
while (wordListDescriptions[numWordLists]) {
70-
++numWordLists;
71-
}
66+
}
67+
int numWordLists = 0;
7268

73-
return numWordLists;
69+
while (wordListDescriptions[numWordLists]) {
70+
++numWordLists;
7471
}
72+
73+
return numWordLists;
7574
}
7675

7776
const char *LexerModule::GetWordListDescription(int index) const noexcept {
7877
assert(index < GetNumWordLists());
7978
if (!wordListDescriptions || (index >= GetNumWordLists())) {
8079
return "";
81-
} else {
82-
return wordListDescriptions[index];
8380
}
81+
return wordListDescriptions[index];
8482
}
8583

8684
const LexicalClass *LexerModule::LexClasses() const noexcept {
@@ -94,8 +92,7 @@ size_t LexerModule::NamedStyles() const noexcept {
9492
Scintilla::ILexer5 *LexerModule::Create() const {
9593
if (fnFactory)
9694
return fnFactory();
97-
else
98-
return new LexerSimple(this);
95+
return new LexerSimple(this);
9996
}
10097

10198
void LexerModule::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,

0 commit comments

Comments
 (0)