Skip to content

Commit

Permalink
reduce some alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Jan 19, 2023
1 parent 09eec3e commit 5d1b5f8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Verify.NUnit/Verifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static InnerVerifier BuildVerifier(string sourceFile, VerifySettings settings, b
}

if (settings.parameters is null &&
adapter.Arguments.Any())
adapter.Arguments.Length > 0)
{
settings.parameters = adapter.Arguments;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Verify/Verifier/InnerVerifier_Inner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool TryGetRootTarget(object? root, [NotNullWhen(true)] out Target? target)
{
var appends = VerifierSettings.GetJsonAppenders(settings);

var hasAppends = appends.Any();
var hasAppends = appends.Count > 0;

if (root is null)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Verify/Verifier/ProjectDirectoryFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static bool TryFind(string testDirectory, [NotNullWhen(true)] out string?
}

static bool ContainsProject(string currentDirectory) =>
Directory.GetFiles(currentDirectory, "*.csproj").Any() ||
Directory.GetFiles(currentDirectory, "*.fsproj").Any() ||
Directory.GetFiles(currentDirectory, "*.vbproj").Any();
Directory.GetFiles(currentDirectory, "*.csproj").Length > 0 ||
Directory.GetFiles(currentDirectory, "*.fsproj").Length > 0 ||
Directory.GetFiles(currentDirectory, "*.vbproj").Length > 0;
}
12 changes: 6 additions & 6 deletions src/Verify/Verifier/VerifyExceptionMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static string Build(

builder.AppendLineN();

if (@new.Any())
if (@new.Count > 0)
{
builder.AppendLineN("New:");
foreach (var file in @new)
Expand All @@ -20,7 +20,7 @@ public static string Build(
}
}

if (notEquals.Any())
if (notEquals.Count > 0)
{
builder.AppendLineN("NotEqual:");
foreach (var file in notEquals)
Expand All @@ -29,7 +29,7 @@ public static string Build(
}
}

if (delete.Any())
if (delete.Count > 0)
{
builder.AppendLineN("Delete:");
foreach (var file in delete)
Expand All @@ -38,7 +38,7 @@ public static string Build(
}
}

if (equal.Any())
if (equal.Count > 0)
{
builder.AppendLineN("Equal:");
foreach (var file in equal)
Expand Down Expand Up @@ -87,7 +87,7 @@ static void AppendContent(string directory, IReadOnlyCollection<NewResult> @new,
builder.AppendLineN("FileContent:");
builder.AppendLineN();

if (newContentFiles.Any())
if (newContentFiles.Count > 0)
{
builder.AppendLineN("New:");
builder.AppendLineN();
Expand All @@ -100,7 +100,7 @@ static void AppendContent(string directory, IReadOnlyCollection<NewResult> @new,
}
}

if (notEqualContentFiles.Any())
if (notEqualContentFiles.Count > 0)
{
builder.AppendLineN("NotEqual:");
builder.AppendLineN();
Expand Down

0 comments on commit 5d1b5f8

Please sign in to comment.