misc: chore: Use collection expressions in Common project

This commit is contained in:
Evan Husted 2025-01-26 15:53:31 -06:00
parent 95f9e548ca
commit 0f857400b6
6 changed files with 9 additions and 9 deletions

View File

@ -106,7 +106,7 @@ namespace Ryujinx.Common.Collections
/// <returns>A list of all RangeNodes sorted by Key Order</returns>
public List<RangeNode<TKey, TValue>> AsList()
{
List<RangeNode<TKey, TValue>> list = new();
List<RangeNode<TKey, TValue>> list = [];
AddToList(Root, list);

View File

@ -139,7 +139,7 @@ namespace Ryujinx.Common.Collections
/// <param name="list">List to add the tree pairs into</param>
public List<KeyValuePair<TKey, TValue>> AsLevelOrderList()
{
List<KeyValuePair<TKey, TValue>> list = new();
List<KeyValuePair<TKey, TValue>> list = [];
Queue<Node<TKey, TValue>> nodes = new();
@ -168,7 +168,7 @@ namespace Ryujinx.Common.Collections
/// <returns>A list of all KeyValuePairs sorted by Key Order</returns>
public List<KeyValuePair<TKey, TValue>> AsList()
{
List<KeyValuePair<TKey, TValue>> list = new();
List<KeyValuePair<TKey, TValue>> list = [];
AddToList(Root, list);

View File

@ -8,7 +8,7 @@ namespace Ryujinx.Common.Configuration
public ModMetadata()
{
Mods = new List<Mod>();
Mods = [];
}
}
}

View File

@ -132,7 +132,7 @@ namespace Ryujinx.Common.Logging
_enabledClasses[index] = true;
}
_logTargets = new List<ILogTarget>();
_logTargets = [];
_time = Stopwatch.StartNew();
@ -203,7 +203,7 @@ namespace Ryujinx.Common.Logging
public static IReadOnlyCollection<LogLevel> GetEnabledLevels()
{
Log?[] logs = new[] { Debug, Info, Warning, Error, Guest, AccessLog, Stub, Trace };
Log?[] logs = [Debug, Info, Warning, Error, Guest, AccessLog, Stub, Trace];
List<LogLevel> levels = new(logs.Length);
foreach (Log? log in logs)
{

View File

@ -125,8 +125,8 @@ namespace Ryujinx.Common.PreciseSleep
}
private readonly Lock _lock = new();
private readonly List<NanosleepThread> _threads = new();
private readonly List<NanosleepThread> _active = new();
private readonly List<NanosleepThread> _threads = [];
private readonly List<NanosleepThread> _active = [];
private readonly Stack<NanosleepThread> _free = new();
private readonly AutoResetEvent _signalTarget;

View File

@ -51,7 +51,7 @@ namespace Ryujinx.Common.SystemInterop
private long _lastId;
private readonly Lock _lock = new();
private readonly List<WaitingObject> _waitingObjects = new();
private readonly List<WaitingObject> _waitingObjects = [];
private WindowsGranularTimer()
{