DES0007 More explicit
November 16, 2020 ยท View on GitHub
More explicit..
Suppressed Diagnostic ID
RCS1242 - Do not pass non-read-only struct by read-only reference
Examples of code that produces a suppressed diagnostic
using DefaultEcs.System;
namespace DummyNamespace
{
partial class DummySystem : AEntitySystem<float>
{
public DummySystem(DefaultWorld world, IParallelRunner runner)
: base(world, runner)
{ }
[Update]
private void Update(float state, in DefaultSpeed speed, ref DefaultPosition position)
{
position.X += speed.X * state;
position.Y += speed.Y * state;
}
}
}
Why is the diagnostic reported?
The type may not be a readonly struct and call to property/method can create a copy.
Why do we suppress this diagnostic?
It is more explicit to say that you only want to read a component value.