Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Enumerable Boxing #1823

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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