Skip to content

Commit

Permalink
Avoid repeatedly constructing lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
jnyrup committed May 27, 2022
1 parent 373a6ad commit 6c5db11
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Src/FluentAssertions/Equivalency/EquivalencyValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ private void RunStepsUntilEquivalencyIsProven(Comparands comparands, IEquivalenc
{
using var _ = context.Tracer.WriteBlock(node => node.Description);

Func<IEquivalencyStep, GetTraceMessage> getMessage = step => _ => $"Equivalency was proven by {step.GetType().Name}";
foreach (IEquivalencyStep step in AssertionOptions.EquivalencyPlan)
{
var result = step.Handle(comparands, context, this);
if (result == EquivalencyResult.AssertionCompleted)
{
context.Tracer.WriteLine(_ => $"Equivalency was proven by {step.GetType().Name}");
context.Tracer.WriteLine(getMessage(step));
return;
}
}
Expand Down

0 comments on commit 6c5db11

Please sign in to comment.