code style

This commit is contained in:
Lightczx
2024-06-03 11:23:22 +08:00
parent 53cda02071
commit 0f3a85e35c
2 changed files with 6 additions and 6 deletions

View File

@@ -7,22 +7,22 @@ namespace Snap.Hutao.Core.Threading;
internal static class SpinWaitPolyfill
{
public static unsafe void SpinUntil<T>(ref T state, delegate*<ref readonly T, bool> condition)
public static unsafe void SpinUntil<T>(ref readonly T state, delegate*<ref readonly T, bool> condition)
{
SpinWait spinner = default;
while (!condition(ref state))
while (!condition(in state))
{
spinner.SpinOnce();
}
}
[SuppressMessage("", "SH002")]
public static unsafe bool SpinUntil<T>(ref T state, delegate*<ref readonly T, bool> condition, TimeSpan timeout)
public static unsafe bool SpinUntil<T>(ref readonly T state, delegate*<ref readonly T, bool> condition, TimeSpan timeout)
{
long startTime = Stopwatch.GetTimestamp();
SpinWait spinner = default;
while (!condition(ref state))
while (!condition(in state))
{
spinner.SpinOnce();

View File

@@ -103,7 +103,7 @@ internal static class TypeNameHelper
if (builder is null)
{
if (options.NestedTypeDelimiter != DefaultNestedTypeDelimiter)
if (options.NestedTypeDelimiter is not DefaultNestedTypeDelimiter)
{
return name.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter);
}
@@ -112,7 +112,7 @@ internal static class TypeNameHelper
}
builder.Append(name);
if (options.NestedTypeDelimiter != DefaultNestedTypeDelimiter)
if (options.NestedTypeDelimiter is not DefaultNestedTypeDelimiter)
{
builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
}