Skip to content

Commit f16d0e2

Browse files
committed
[CSDiagnostics] Use join() directly and remove the if/else
1 parent c7088ff commit f16d0e2

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,15 +2494,8 @@ bool ContextualFailure::tryProtocolConformanceFixIt(
24942494
assert(!missingProtoTypeStrings.empty() &&
24952495
"type already conforms to all the protocols?");
24962496

2497-
// If we didn't have a protocol composition type, it means we only have a
2498-
// single protocol, so just use it directly. Otherwise, construct a comma
2499-
// separated list of missing types.
2500-
std::string protoString;
2501-
if (missingProtoTypeStrings.size() == 1) {
2502-
protoString = missingProtoTypeStrings.front();
2503-
} else {
2504-
protoString = llvm::join(missingProtoTypeStrings, ", ");
2505-
}
2497+
// Combine all protocol names together, separated by commas.
2498+
std::string protoString = llvm::join(missingProtoTypeStrings, ", ");
25062499

25072500
// Emit a diagnostic to inform the user that they need to conform to the
25082501
// missing protocols.

0 commit comments

Comments
 (0)