mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C#: Use the first best location from the list of locations.
This commit is contained in:
@@ -76,7 +76,7 @@ namespace Semmle.Extraction
|
||||
/// lexicographically smaller filepath and span is considered better.
|
||||
/// </summary>
|
||||
public static Location? BestOrDefault(this IEnumerable<Location> locations) =>
|
||||
locations.Any() ? locations.Aggregate((best, loc) => BetterThan(best, loc) ? best : loc) : null;
|
||||
locations.Any() ? locations.Aggregate((best, loc) => BetterThan(loc, best) ? loc : best) : null;
|
||||
|
||||
public static Location Best(this IEnumerable<Location> locations) =>
|
||||
locations.BestOrDefault() ?? throw new ArgumentException("No location found.");
|
||||
|
||||
Reference in New Issue
Block a user