Skip to content

Commit

Permalink
Remove redundant is check in It
Browse files Browse the repository at this point in the history
... because `Match` matchers will already have checked `value is T`
by the time the predicate delegate gets invoked.
  • Loading branch information
stakx committed Aug 29, 2019
1 parent ca229eb commit 3fbed15
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Moq/It.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public static TValue IsAny<TValue>()
{
return Match<TValue>.Create(
#if FEATURE_COM
value => value == null || (typeof(TValue).IsAssignableFrom(value.GetType())
|| (IsComObject(value) && value is TValue)),
value => value == null || (typeof(TValue).IsAssignableFrom(value.GetType()) || IsComObject(value)),
#else
value => value == null || typeof(TValue).IsAssignableFrom(value.GetType()),
#endif
Expand All @@ -73,8 +72,7 @@ public static TValue IsNotNull<TValue>()
{
return Match<TValue>.Create(
#if FEATURE_COM
value => value != null && (typeof(TValue).IsAssignableFrom(value.GetType())
|| (IsComObject(value) && value is TValue)),
value => value != null && (typeof(TValue).IsAssignableFrom(value.GetType()) || IsComObject(value)),
#else
value => value != null && typeof(TValue).IsAssignableFrom(value.GetType()),
#endif
Expand Down

0 comments on commit 3fbed15

Please sign in to comment.