Skip to content

Commit 9ac7b70

Browse files
Potential fix for pull request finding 'Missed opportunity to use Where'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent 03ef6e9 commit 9ac7b70

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/services/Elastic.Documentation.Services/ChangelogService.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,9 @@ AccessViolationException or
487487

488488
private static string? MapLabelsToType(string[] labels, Dictionary<string, string> labelToTypeMapping)
489489
{
490-
foreach (var label in labels)
491-
{
492-
if (labelToTypeMapping.TryGetValue(label, out var mappedType))
493-
{
494-
return mappedType;
495-
}
496-
}
497-
return null;
490+
return labels
491+
.Select(label => labelToTypeMapping.TryGetValue(label, out var mappedType) ? mappedType : null)
492+
.FirstOrDefault(mappedType => mappedType != null);
498493
}
499494

500495
private static List<string> MapLabelsToAreas(string[] labels, Dictionary<string, string> labelToAreasMapping)

0 commit comments

Comments
 (0)