Skip to content

Commit

Permalink
Merge pull request #1823 from SimonCropp/removeEnumerableBoxing
Browse files Browse the repository at this point in the history
Remove Enumerable Boxing
  • Loading branch information
JeremySkinner committed Sep 13, 2021
2 parents 4fea061 + c02491f commit 155cffc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/FluentValidation/Validators/EmptyValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace FluentValidation.Validators {
using System;
using System.Collections;
using Resources;
using System.Linq;

public class EmptyValidator<T,TProperty> : PropertyValidator<T,TProperty> {

Expand All @@ -34,7 +33,7 @@ public class EmptyValidator<T,TProperty> : PropertyValidator<T,TProperty> {
case string s when string.IsNullOrWhiteSpace(s):
case ICollection {Count: 0}:
case Array {Length: 0}:
case IEnumerable e when !e.Cast<object>().Any():
case IEnumerable e when !e.GetEnumerator().MoveNext():
return true;
}

Expand Down
5 changes: 2 additions & 3 deletions src/FluentValidation/Validators/NotEmptyValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace FluentValidation.Validators {
using System;
using System.Collections;
using System.Linq;
using Resources;

public class NotEmptyValidator<T,TProperty> : PropertyValidator<T, TProperty>, INotEmptyValidator {
Expand All @@ -33,8 +32,8 @@ public class NotEmptyValidator<T,TProperty> : PropertyValidator<T, TProperty>, I
case null:
case string s when string.IsNullOrWhiteSpace(s):
case ICollection {Count: 0}:
case Array {Length: 0}c:
case IEnumerable e when !e.Cast<object>().Any():
case Array {Length: 0}:
case IEnumerable e when !e.GetEnumerator().MoveNext():
return false;
}

Expand Down

0 comments on commit 155cffc

Please sign in to comment.