Skip to content

Commit

Permalink
minor improvement linq query
Browse files Browse the repository at this point in the history
  • Loading branch information
coenm committed May 17, 2024
1 parent 533b5c1 commit 80be579
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/RepoM.App/RepositoryFiltering/RepositoryMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace RepoM.App.RepositoryFiltering;

using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using RepoM.Core.Plugin.Repository;
using RepoM.Core.Plugin.RepositoryFiltering;
using RepoM.Core.Plugin.RepositoryFiltering.Clause;
Expand Down Expand Up @@ -67,17 +68,15 @@ private bool HandleTerm(IRepository repository, TermBase termBase)
return false;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private bool HandleAnd(IRepository repository, AndQuery and)
{
return and.Items
.Select(q => Matches(repository, q))
.All(result => result);
return and.Items.All(query => Matches(repository, query));
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private bool HandleOr(IRepository repository, OrQuery or)
{
return or.Items
.Select(q => Matches(repository, q))
.Any(result => result);
return or.Items.Any(query => Matches(repository, query));
}
}

0 comments on commit 80be579

Please sign in to comment.