Skip to content

Commit

Permalink
[gardening] Avoid "var == true" and "var == false"
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalswift committed Jan 23, 2016
1 parent df9bd8a commit 638a7c9
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/swift/Basic/JSONSerialization.h
Expand Up @@ -398,7 +398,7 @@ class Output {
template <typename T>
void processKeyWithDefault(const char *Key, Optional<T> &Val,
const Optional<T> &DefaultValue, bool Required) {
assert(DefaultValue.hasValue() == false &&
assert(!DefaultValue.hasValue() &&
"Optional<T> shouldn't have a value!");
void *SaveInfo;
bool UseDefault;
Expand Down
2 changes: 1 addition & 1 deletion lib/Basic/Demangle.cpp
Expand Up @@ -2528,7 +2528,7 @@ class NodePrinter {
return;
}

if (Options.SynthesizeSugarOnTypes == false ||
if (!Options.SynthesizeSugarOnTypes ||
pointer->getKind() == Node::Kind::BoundGenericClass)
{
// no sugar here
Expand Down
2 changes: 1 addition & 1 deletion lib/IDE/CodeCompletion.cpp
Expand Up @@ -1743,7 +1743,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
}

auto ItAndInserted = DeducedAssociatedTypeCache.insert({ NTD, Types });
assert(ItAndInserted.second == true && "should not be in the map");
assert(ItAndInserted.second && "should not be in the map");
return ItAndInserted.first->second;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/SIL/SILVerifier.cpp
Expand Up @@ -2807,12 +2807,12 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
bool FoundThrowBlock = false;
for (auto &BB : *F) {
if (isa<ReturnInst>(BB.getTerminator())) {
require(FoundReturnBlock == false,
require(!FoundReturnBlock,
"more than one return block in function");
FoundReturnBlock = true;
}
if (isa<ThrowInst>(BB.getTerminator())) {
require(FoundThrowBlock == false,
require(!FoundThrowBlock,
"more than one throw block in function");
FoundThrowBlock = true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Analysis/ArraySemantic.cpp
Expand Up @@ -245,7 +245,7 @@ static bool canHoistArrayArgument(ApplyInst *SemanticsCall, SILValue Arr,
InsertBefore->getParent())) &&
(SEI = dyn_cast<StructElementAddrInst>(Val)))
Val = SEI->getOperand().getDef();
return DoesNotDominate == false;
return !DoesNotDominate;
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp
Expand Up @@ -1315,7 +1315,7 @@ bool COWArrayOpt::hasLoopOnlyDestructorSafeArrayOperations() {
if (CachedSafeLoop.first)
return CachedSafeLoop.second;

assert(CachedSafeLoop.second == false &&
assert(!CachedSafeLoop.second &&
"We only move to a true state below");

// We will compute the state of this loop now.
Expand Down
2 changes: 1 addition & 1 deletion utils/test-clustered-bit-vector/test.cpp
Expand Up @@ -5,5 +5,5 @@ int main() {
cbvs[7].appendSetBits(65);
cbvs[3].appendClearBits(118);
cbvs[7] = std::move(cbvs[3]);
assert(cbvs[7][64] == false);
assert(!cbvs[7][64]);
}

0 comments on commit 638a7c9

Please sign in to comment.