Switch zip to zip_equal where possible (#6389)

There are two uses I'm not converting here, that seem to want the
"shortest" behavior. For everything else, I'm going to `zip_equal` since
it's more restrictive.

I wish `zip` were named `zip_shortest`.
This commit is contained in:
Jon Ross-Perkins
2025-11-18 00:28:06 +00:00
committed by GitHub
parent 205aea9a3e
commit fbc7690157
13 changed files with 34 additions and 31 deletions
+2 -1
View File
@@ -82,7 +82,8 @@ static auto DiagnoseDuplicateNames(
llvm::ArrayRef<SemIR::StructTypeField> fields, bool is_struct_type_literal)
-> bool {
Map<SemIR::NameId, Parse::NodeId> names;
for (auto [field_name_node, field] : llvm::zip(field_name_nodes, fields)) {
for (auto [field_name_node, field] :
llvm::zip_equal(field_name_nodes, fields)) {
auto result = names.Insert(field.name_id, field_name_node);
if (!result.is_inserted()) {
CARBON_DIAGNOSTIC(StructNameDuplicate, Error,