Browse Source

clang-tidy: fix `readability-else-after-return` lints

Ben Boeckel 2 years ago
parent
commit
ffa49c23aa

+ 8 - 8
Source/CPack/WiX/cmCPackWIXGenerator.cxx

@@ -997,12 +997,12 @@ bool cmCPackWIXGenerator::RequireOption(std::string const& name,
     value = *tmp;
 
     return true;
-  } else {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-                  "Required variable " << name << " not set" << std::endl);
-
-    return false;
   }
+
+  cmCPackLogger(cmCPackLog::LOG_ERROR,
+                "Required variable " << name << " not set" << std::endl);
+
+  return false;
 }
 
 std::string cmCPackWIXGenerator::GetArchitecture() const
@@ -1012,9 +1012,8 @@ std::string cmCPackWIXGenerator::GetArchitecture() const
 
   if (void_p_size == "8"_s) {
     return "x64";
-  } else {
-    return "x86";
   }
+  return "x86";
 }
 
 std::string cmCPackWIXGenerator::GenerateGUID()
@@ -1109,7 +1108,8 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path)
                     << path << '\'' << std::endl);
 
     return std::string();
-  } else if (ambiguityCount > 1) {
+  }
+  if (ambiguityCount > 1) {
     result << '_' << ambiguityCount;
   }
 

+ 2 - 1
Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx

@@ -158,7 +158,8 @@ void cmWIXRichTextFormatWriter::EmitUnicodeCodepoint(int c)
   // Do not emit byte order mark (BOM)
   if (c == 0xFEFF) {
     return;
-  } else if (c <= 0xFFFF) {
+  }
+  if (c <= 0xFFFF) {
     EmitUnicodeSurrogate(c);
   } else {
     c -= 0x10000;