Use 'new' expression in places where the type is evident for content (#2590)
* Content.Client * Content.Benchmarks * Content.IntegrationTests * Content.Server * Content.Server.Database * Content.Shared * Content.Tests * Merge fixes Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -105,7 +105,7 @@ namespace Content.Benchmarks
|
||||
[MethodImpl(AggressiveOpt)]
|
||||
public static Color InterpolateSimple(Color a, Color b, float lambda)
|
||||
{
|
||||
return new Color(
|
||||
return new(
|
||||
a.R + (b.R - a.R) * lambda,
|
||||
a.G + (b.G - a.G) * lambda,
|
||||
a.B + (b.G - a.B) * lambda,
|
||||
|
||||
@@ -11,14 +11,14 @@ namespace Content.Benchmarks
|
||||
[Params(5000)] public int NEnt { get; set; }
|
||||
|
||||
private readonly Dictionary<(EntityUid, Type), BComponent>
|
||||
_componentsFlat = new Dictionary<(EntityUid, Type), BComponent>();
|
||||
_componentsFlat = new();
|
||||
|
||||
private readonly Dictionary<Type, Dictionary<EntityUid, BComponent>> _componentsPart =
|
||||
new Dictionary<Type, Dictionary<EntityUid, BComponent>>();
|
||||
new();
|
||||
|
||||
private UniqueIndex<Type, BComponent> _allComponents = new UniqueIndex<Type, BComponent>();
|
||||
private UniqueIndex<Type, BComponent> _allComponents = new();
|
||||
|
||||
private readonly List<EntityUid> _lookupEntities = new List<EntityUid>();
|
||||
private readonly List<EntityUid> _lookupEntities = new();
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Benchmarks
|
||||
{
|
||||
public class ComponentManagerGetAllComponents
|
||||
{
|
||||
private readonly List<IEntity> _entities = new List<IEntity>();
|
||||
private readonly List<IEntity> _entities = new();
|
||||
|
||||
private IComponentManager _componentManager;
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace Content.Benchmarks
|
||||
{
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
new Box2(-3, 3, -3, 3), // point off to the bottom left
|
||||
new Box2(-3, -3, -3, -3), // point off to the top left
|
||||
new Box2(3, 3, 3, 3), // point off to the bottom right
|
||||
new Box2(3, -3, 3, -3), // point off to the top right
|
||||
new(-3, 3, -3, 3), // point off to the bottom left
|
||||
new(-3, -3, -3, -3), // point off to the top left
|
||||
new(3, 3, 3, 3), // point off to the bottom right
|
||||
new(3, -3, 3, -3), // point off to the top right
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
@@ -24,10 +24,10 @@ namespace Content.Benchmarks
|
||||
((Box2) default).Enlarged(1), //2x2 square
|
||||
((Box2) default).Enlarged(2), //4x4 square
|
||||
((Box2) default).Enlarged(3), //6x6 square
|
||||
new Box2(-3, 3, -3, 3), // point off to the bottom left
|
||||
new Box2(-3, -3, -3, -3), // point off to the top left
|
||||
new Box2(3, 3, 3, 3), // point off to the bottom right
|
||||
new Box2(3, -3, 3, -3), // point off to the top right
|
||||
new(-3, 3, -3, 3), // point off to the bottom left
|
||||
new(-3, -3, -3, -3), // point off to the top left
|
||||
new(3, 3, 3, 3), // point off to the bottom right
|
||||
new(3, -3, 3, -3), // point off to the top right
|
||||
};
|
||||
|
||||
private B2DynamicTree<int> _b2Tree;
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Content.Benchmarks
|
||||
|
||||
public int M { get; set; } = 10;
|
||||
|
||||
private readonly DictEntityStorage _dictStorage = new DictEntityStorage();
|
||||
private readonly GenEntityStorage _genStorage = new GenEntityStorage();
|
||||
private readonly DictEntityStorage _dictStorage = new();
|
||||
private readonly GenEntityStorage _genStorage = new();
|
||||
|
||||
private IEntityStorage<DictEntity, DictEntityUid> _dictStorageInterface;
|
||||
private IEntityStorage<GenEntity, GenEntityUid> _genStorageInterface;
|
||||
@@ -146,7 +146,7 @@ namespace Content.Benchmarks
|
||||
{
|
||||
private int _nextValue;
|
||||
|
||||
private readonly Dictionary<DictEntityUid, DictEntity> _dict = new Dictionary<DictEntityUid, DictEntity>();
|
||||
private readonly Dictionary<DictEntityUid, DictEntity> _dict = new();
|
||||
|
||||
public override bool TryGetEntity(DictEntityUid entityUid, out DictEntity entity)
|
||||
{
|
||||
@@ -198,7 +198,7 @@ namespace Content.Benchmarks
|
||||
private sealed class GenEntityStorage : EntityStorage<GenEntity, GenEntityUid>
|
||||
{
|
||||
private (int generation, GenEntity entity)[] _entities = new (int, GenEntity)[1];
|
||||
private readonly List<int> _availableSlots = new List<int> {0};
|
||||
private readonly List<int> _availableSlots = new() {0};
|
||||
|
||||
public override bool TryGetEntity(GenEntityUid entityUid, out GenEntity entity)
|
||||
{
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace Content.Benchmarks
|
||||
[Params(8, 64, 256, 1024)]
|
||||
public int StringLength { get; set; }
|
||||
|
||||
private readonly MemoryStream _outputStream = new MemoryStream(2048);
|
||||
private readonly MemoryStream _inputStream = new MemoryStream(2048);
|
||||
private readonly MemoryStream _outputStream = new(2048);
|
||||
private readonly MemoryStream _inputStream = new(2048);
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
|
||||
Reference in New Issue
Block a user