Skip to content

Commit

Permalink
apply the hint by rider.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 1, 2022
1 parent f9bd96c commit 554da10
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion osu.Framework/Utils/ConvexPolygonClipper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Span<Vector2> Clip(in Span<Vector2> buffer)
if (validClipEdges < 3)
return Span<Vector2>.Empty;

return buffer.Slice(0, inputCount);
return buffer[..inputCount];
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
6 changes: 2 additions & 4 deletions osu.Framework/Utils/Interpolation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static class Interpolation
/// <param name="exponent">The exponent of the exponential. An exponent of 0 results in the start values, whereas larger exponents make the result converge to the final value.</param>
public static double Damp(double start, double final, double @base, double exponent)
{
if (@base < 0 || @base > 1)
if (@base is < 0 or > 1)
throw new ArgumentOutOfRangeException(nameof(@base), $"{nameof(@base)} has to lie in [0,1], but is {@base}.");

return Lerp(start, final, 1 - Math.Pow(@base, exponent));
Expand Down Expand Up @@ -390,9 +390,7 @@ static GenericInterpolation()
FUNCTION = (InterpolationFunc<TValue, TEasing>)valueAtMethod.CreateDelegate(typeof(InterpolationFunc<TValue, TEasing>));
else
{
var typeRef = FormatterServices.GetSafeUninitializedObject(typeof(TValue)) as IInterpolable<TValue>;

if (typeRef == null)
if (FormatterServices.GetSafeUninitializedObject(typeof(TValue)) is not IInterpolable<TValue> typeRef)
throw new NotSupportedException($"Type {typeof(TValue)} has no interpolation function. Implement the interface {typeof(IInterpolable<TValue>)} interface on the object.");

FUNCTION = typeRef.ValueAt;
Expand Down

0 comments on commit 554da10

Please sign in to comment.