Skip to content

Commit 1aed3b3

Browse files
Tidy nullability in It.cs.
1 parent 7b3e638 commit 1aed3b3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Moq/It.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static class Ref<TValue>
3232
/// <summary>
3333
/// Matches any value that is assignment-compatible with type <typeparamref name="TValue"/>.
3434
/// </summary>
35-
public static TValue IsAny;
35+
public static TValue IsAny = default(TValue)!;
3636
}
3737

3838
/// <summary>
@@ -64,7 +64,7 @@ public static TValue IsAny<TValue>()
6464
}
6565
}
6666

67-
static readonly MethodInfo isAnyMethod = typeof(It).GetMethod(nameof(It.IsAny), BindingFlags.Public | BindingFlags.Static);
67+
static readonly MethodInfo isAnyMethod = typeof(It).GetMethod(nameof(It.IsAny), BindingFlags.Public | BindingFlags.Static)!;
6868

6969
internal static MethodCallExpression IsAny(Type genericArgument)
7070
{
@@ -143,7 +143,7 @@ public static TValue Is<TValue>(Expression<Func<TValue, bool>> match)
143143
throw new ArgumentException(Resources.UseItIsOtherOverload, nameof(match));
144144
}
145145

146-
var thisMethod = (MethodInfo)MethodBase.GetCurrentMethod();
146+
var thisMethod = (MethodInfo)MethodBase.GetCurrentMethod()!;
147147
var compiledMatchMethod = match.CompileUsingExpressionCompiler();
148148

149149
return Match.Create<TValue>(
@@ -165,9 +165,9 @@ public static TValue Is<TValue>(Expression<Func<TValue, bool>> match)
165165
/// Allows the specification of a predicate to perform matching of method call arguments.
166166
/// </remarks>
167167
[EditorBrowsable(EditorBrowsableState.Advanced)]
168-
public static TValue Is<TValue>(Expression<Func<object, Type, bool>> match)
168+
public static TValue Is<TValue>(Expression<Func<object?, Type, bool>> match)
169169
{
170-
var thisMethod = (MethodInfo)MethodBase.GetCurrentMethod();
170+
var thisMethod = (MethodInfo)MethodBase.GetCurrentMethod()!;
171171
var compiledMatchMethod = match.CompileUsingExpressionCompiler();
172172

173173
return Match.Create<TValue>(

0 commit comments

Comments
 (0)