Skip to content

Commit a6214ee

Browse files
committed
Use Count checks instead of Any()
1 parent 6b5b366 commit a6214ee

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/MarkdownSnippets/InterpretErrors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class InterpretErrors
1010
/// </summary>
1111
public static string ErrorsAsMarkdown(this IReadOnlyList<Snippet> snippets)
1212
{
13-
if (!snippets.Any())
13+
if (snippets.Count == 0)
1414
{
1515
return "";
1616
}

src/MarkdownSnippets/Processing/DirectoryMarkdownProcessor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void ProcessFile(string sourceFile, MarkdownProcessor markdownProcessor)
267267
var result = markdownProcessor.Apply(lines, newLine, relativeSource);
268268

269269
var missingSnippets = result.MissingSnippets;
270-
if (missingSnippets.Any())
270+
if (missingSnippets.Count != 0)
271271
{
272272
// If the config value is set to treat missing snippets as warnings, then don't throw
273273
if (treatMissingAsWarning)
@@ -284,7 +284,7 @@ void ProcessFile(string sourceFile, MarkdownProcessor markdownProcessor)
284284
}
285285

286286
var missingIncludes = result.MissingIncludes;
287-
if (missingIncludes.Any())
287+
if (missingIncludes.Count != 0)
288288
{
289289
// If the config value is set to treat missing include as warnings, then don't throw
290290
if (treatMissingAsWarning)
@@ -301,7 +301,7 @@ void ProcessFile(string sourceFile, MarkdownProcessor markdownProcessor)
301301
}
302302

303303
var errors = result.ValidationErrors;
304-
if (errors.Any())
304+
if (errors.Count != 0)
305305
{
306306
throw new ContentValidationException(errors);
307307
}

src/MarkdownSnippets/Processing/MarkdownProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public string Apply(string input, string? file = null)
9090
using var writer = new StringWriter(builder);
9191
var processResult = Apply(reader, writer, file);
9292
var missing = processResult.MissingSnippets;
93-
if (missing.Any())
93+
if (missing.Count != 0)
9494
{
9595
throw new MissingSnippetsException(missing);
9696
}

src/MarkdownSnippets/Processing/ProcessResult.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ public class ProcessResult(
2626
/// </summary>
2727
public virtual IEnumerator<Snippet> GetEnumerator()
2828
{
29-
if (MissingSnippets.Any())
29+
if (MissingSnippets.Count != 0)
3030
{
3131
throw new MissingSnippetsException(MissingSnippets);
3232
}
3333

34-
if (MissingIncludes.Any())
34+
if (MissingIncludes.Count != 0)
3535
{
3636
throw new MissingIncludesException(MissingIncludes);
3737
}
3838

39-
if (ValidationErrors.Any())
39+
if (ValidationErrors.Count != 0)
4040
{
4141
throw new ContentValidationException(ValidationErrors);
4242
}

src/MarkdownSnippets/Reading/ReadSnippets.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public ReadSnippets(IReadOnlyList<Snippet> snippets, IReadOnlyList<string> files
2222
/// </summary>
2323
public virtual IEnumerator<Snippet> GetEnumerator()
2424
{
25-
if (SnippetsInError.Any())
25+
if (SnippetsInError.Count != 0)
2626
{
2727
throw new SnippetReadingException($"SnippetsInError: {string.Join(", ", SnippetsInError.Select(_ => _.Key))}");
2828
}

0 commit comments

Comments
 (0)