diff --git a/src/NSubstitute/Arg.cs b/src/NSubstitute/Arg.cs
index c0313bb2..f03b636c 100644
--- a/src/NSubstitute/Arg.cs
+++ b/src/NSubstitute/Arg.cs
@@ -1,11 +1,11 @@
using System;
using System.Linq.Expressions;
-using NSubstitute.Core;
using NSubstitute.Core.Arguments;
-using NSubstitute.Exceptions;
// Disable nullability for client API, so it does not affect clients.
#nullable disable annotations
+#pragma warning disable CS1574
+#pragma warning disable CS0419
namespace NSubstitute
{
@@ -14,7 +14,9 @@ namespace NSubstitute
///
public static class Arg
{
- public class AnyType { }
+ public class AnyType
+ {
+ }
///
/// Match any argument value compatible with type .
@@ -96,20 +98,14 @@ public static ref TDelegate InvokeDelegate(params object[] arguments)
///
public static ref T Do(Action useArgument)
{
- if (typeof(T) == typeof(AnyType))
- {
- SubstitutionContext.Current.ThreadContext.DequeueAllArgumentSpecifications();
- throw new DoAnyTypeException();
- }
-
return ref ArgumentMatcher.Enqueue(new AnyArgumentMatcher(typeof(T)), x => useArgument((T) x!));
}
///
- /// Capture any argument and use it to call the function
+ /// Capture any argument compatible with type and use it to call the function
/// whenever a matching call is made to the substitute.
///
- public static ref AnyType DoForAny(Action