Skip to content

Commit c1bf33e

Browse files
authored
Remove redundant nullable warning suppression (#118347)
1 parent ed96395 commit c1bf33e

File tree

59 files changed

+129
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+129
-130
lines changed

src/coreclr/System.Private.CoreLib/src/System/Attribute.CoreCLR.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type t
170170
{
171171
rtAdd = rtAdd.GetParentDefinition();
172172
if (rtAdd != null)
173-
return rtAdd.DeclaringType!.GetEvent(ev.Name!);
173+
return rtAdd.DeclaringType!.GetEvent(ev.Name);
174174
}
175175
return null;
176176
}

src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ internal void InitializeSourceInfo(bool fNeedFileInfo, Exception? exception)
118118
// ENC or the source/line info was already retrieved, the method token is 0.
119119
if (rgiMethodToken![index] != 0)
120120
{
121-
GetSourceLineInfo(s_stackTraceSymbolsCache!, rgAssembly![index], rgAssemblyPath![index]!, rgLoadedPeAddress![index], rgiLoadedPeSize![index], rgiIsFileLayout![index],
121+
GetSourceLineInfo(s_stackTraceSymbolsCache, rgAssembly![index], rgAssemblyPath![index], rgLoadedPeAddress![index], rgiLoadedPeSize![index], rgiIsFileLayout![index],
122122
rgInMemoryPdbAddress![index], rgiInMemoryPdbSize![index], rgiMethodToken![index],
123123
rgiILOffset![index], out rgFilename![index], out rgiLineNumber![index], out rgiColumnNumber![index]);
124124
}

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ private static unsafe void ConfigCallback(void* configurationContext, void* name
884884

885885
ref GCConfigurationContext context = ref Unsafe.As<byte, GCConfigurationContext>(ref *(byte*)configurationContext);
886886
Debug.Assert(context.Configurations != null);
887-
Dictionary<string, object> configurationDictionary = context.Configurations!;
887+
Dictionary<string, object> configurationDictionary = context.Configurations;
888888

889889
string nameAsString = Marshal.PtrToStringUTF8((IntPtr)name)!;
890890
switch (type)

src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeModuleBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ private static MethodBase GetGenericMethodBaseDefinition(MethodBase methodBase)
416416
{
417417
Debug.Assert(masmi != null);
418418

419-
methDef = masmi.GetGenericMethodDefinition()!;
419+
methDef = masmi.GetGenericMethodDefinition();
420420
methDef = methDef.Module.ResolveMethod(
421421
methodBase.MetadataToken,
422422
methDef.DeclaringType?.GetGenericArguments(),
@@ -1070,7 +1070,7 @@ internal int GetMethodTokenInternal(MethodBase method, Type[]? optionalParameter
10701070

10711071
if (!isGenericMethodDef)
10721072
{
1073-
methodInfoUnbound = methodInfo.GetGenericMethodDefinition()!;
1073+
methodInfoUnbound = methodInfo.GetGenericMethodDefinition();
10741074
}
10751075

10761076
if (!Equals(methodInfoUnbound.Module)

src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ private RuntimeCustomAttributeData(RuntimeModule scope, MetadataToken caCtorToke
253253
m_scope = scope;
254254
m_ctor = (RuntimeConstructorInfo)RuntimeType.GetMethodBase(m_scope, caCtorToken)!;
255255

256-
if (m_ctor!.DeclaringType!.IsGenericType)
256+
if (m_ctor.DeclaringType!.IsGenericType)
257257
{
258258
MetadataImport metadataScope = m_scope.MetadataImport;
259-
Type attributeType = m_scope.ResolveType(metadataScope.GetParentToken(caCtorToken), null, null)!;
259+
Type attributeType = m_scope.ResolveType(metadataScope.GetParentToken(caCtorToken), null, null);
260260
m_ctor = (RuntimeConstructorInfo)m_scope.ResolveMethod(caCtorToken, attributeType.GenericTypeArguments, null)!.MethodHandle.GetMethodInfo();
261261
}
262262

src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ internal ReadOnlySpan<ParameterInfo> GetIndexParametersSpan()
305305
Array.Empty<ParameterInfo>();
306306

307307
for (int i = 0; i < propParams.Length; i++)
308-
propParams[i] = new RuntimeParameterInfo((RuntimeParameterInfo)methParams![i], this);
308+
propParams[i] = new RuntimeParameterInfo((RuntimeParameterInfo)methParams[i], this);
309309

310310
m_parameters = propParams;
311311
}

src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ internal bool IsNullHandle()
10481048

10491049
public IntPtr GetFunctionPointer()
10501050
{
1051-
IntPtr ptr = GetFunctionPointer(EnsureNonNullMethodInfo(m_value!).Value);
1051+
IntPtr ptr = GetFunctionPointer(EnsureNonNullMethodInfo(m_value).Value);
10521052
GC.KeepAlive(m_value);
10531053
return ptr;
10541054
}

src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ private void MergeWithGlobalList(T[] list)
560560
cachedMembers = cachedMembers2;
561561
}
562562

563-
Debug.Assert(cachedMembers![freeSlotIndex] == null);
563+
Debug.Assert(cachedMembers[freeSlotIndex] == null);
564564
Volatile.Write(ref cachedMembers[freeSlotIndex], newMemberInfo); // value may be read outside of lock
565565
freeSlotIndex++;
566566
}
@@ -1350,7 +1350,7 @@ private void PopulateProperties(
13501350

13511351
for (int j = 0; j < list.Count; j++)
13521352
{
1353-
if (propertyInfo.EqualsSig(list[j]!))
1353+
if (propertyInfo.EqualsSig(list[j]))
13541354
{
13551355
duplicate = true;
13561356
break;

src/coreclr/System.Private.CoreLib/src/System/String.CoreCLR.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static string Intern(string str)
4040
{
4141
ArgumentNullException.ThrowIfNull(str);
4242
Intern(new StringHandleOnStack(ref str!));
43-
return str!;
43+
return str;
4444
}
4545

4646
[LibraryImport(RuntimeHelpers.QCall, EntryPoint = "String_IsInterned")]

src/libraries/Common/src/System/IO/PathInternal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ internal static bool RemoveRelativeSegments(ReadOnlySpan<char> path, int rootLen
218218
[return: NotNullIfNotNull(nameof(path))]
219219
internal static string? TrimEndingDirectorySeparator(string? path) =>
220220
EndsInDirectorySeparator(path) && !IsRoot(path.AsSpan()) ?
221-
path!.Substring(0, path.Length - 1) :
221+
path.Substring(0, path.Length - 1) :
222222
path;
223223

224224
/// <summary>

0 commit comments

Comments
 (0)