Skip to content

Commit

Permalink
Replace usages of is null with == null
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Apr 2, 2024
1 parent aa7b357 commit 94cbe18
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectMerging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void TestMergeCircleSlider()

AddAssert("slider created", () =>
{
if (circle1 is null || circle2 is null || slider is null)
if (circle1 == null || circle2 == null || slider == null)
return false;

var controlPoints = slider.Path.ControlPoints;
Expand Down Expand Up @@ -111,7 +111,7 @@ public void TestMergeSliderSlider()

AddAssert("slider created", () =>
{
if (slider1 is null || slider2 is null || slider1Path is null)
if (slider1 == null || slider2 == null || slider1Path == null)
return false;

var controlPoints1 = slider1Path.ControlPoints;
Expand Down Expand Up @@ -143,7 +143,7 @@ public void TestMergeSliderSlider()

AddAssert("slider end is at same completion for last slider", () =>
{
if (slider1Path is null || slider2 is null)
if (slider1Path == null || slider2 == null)
return false;

var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
Expand Down Expand Up @@ -256,7 +256,7 @@ public void TestMergeSliderSliderSameStartTime()

AddAssert("slider created", () =>
{
if (slider1 is null || slider2 is null || slider1Path is null)
if (slider1 == null || slider2 == null || slider1Path == null)
return false;

var controlPoints1 = slider1Path.ControlPoints;
Expand Down Expand Up @@ -288,7 +288,7 @@ public void TestMergeSliderSliderSameStartTime()

AddAssert("slider end is at same completion for last slider", () =>
{
if (slider1Path is null || slider2 is null)
if (slider1Path == null || slider2 == null)
return false;

var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
Expand Down Expand Up @@ -322,7 +322,7 @@ public void TestMergeSliderSliderSameStartAndEndTime()

AddAssert("slider created", () =>
{
if (slider1 is null || slider2 is null || slider1Path is null)
if (slider1 == null || slider2 == null || slider1Path == null)
return false;

var controlPoints1 = slider1Path.ControlPoints;
Expand Down Expand Up @@ -354,7 +354,7 @@ public void TestMergeSliderSliderSameStartAndEndTime()

AddAssert("slider end is at same completion for last slider", () =>
{
if (slider1Path is null || slider2 is null)
if (slider1Path == null || slider2 == null)
return false;

var mergedSlider = (Slider)EditorBeatmap.SelectedHitObjects.First();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void TestSplitRetainsHitsounds()

AddStep("add hitsounds", () =>
{
if (slider is null) return;
if (slider == null) return;

sample = new HitSampleInfo("hitwhistle", HitSampleInfo.BANK_SOFT, volume: 70);
slider.Samples.Add(sample.With());
Expand Down Expand Up @@ -228,7 +228,7 @@ private void moveMouseToControlPoint(int index)
{
AddStep($"move mouse to control point {index}", () =>
{
if (slider is null || visualiser is null) return;
if (slider == null || visualiser == null) return;

Vector2 position = slider.Path.ControlPoints[index].Position + slider.Position;
InputManager.MoveMouseTo(visualiser.Pieces[0].Parent!.ToScreenSpace(position));
Expand All @@ -239,7 +239,7 @@ private void addContextMenuItemStep(string contextMenuText)
{
AddStep($"click context menu item \"{contextMenuText}\"", () =>
{
if (visualiser is null) return;
if (visualiser == null) return;

MenuItem? item = visualiser.ContextMenuItems?.FirstOrDefault(menuItem => menuItem.Text.Value == contextMenuText);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private void splitControlPoints(List<PathControlPoint> controlPointsToSplitAt)

foreach (var splitPoint in controlPointsToSplitAt)
{
if (splitPoint == controlPoints[0] || splitPoint == controlPoints[^1] || splitPoint.Type is null)
if (splitPoint == controlPoints[0] || splitPoint == controlPoints[^1] || splitPoint.Type == null)
continue;

// Split off the section of slider before this control point so the remaining control points to split are in the latter part of the slider.
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Overlays/Mods/ModSelectOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ void hideOverlay(bool immediate)
/// </remarks>>
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
if (e.Repeat || e.Action != PlatformAction.SelectAll || SelectAllModsButton is null)
if (e.Repeat || e.Action != PlatformAction.SelectAll || SelectAllModsButton == null)
return false;

SelectAllModsButton.TriggerClick();
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ private IEnumerable<ArraySegment<PathControlPoint>> convertPoints(PathType type,
// Edge-case rules (to match stable).
if (type == PathType.PERFECT_CURVE)
{
int endPointLength = endPoint is null ? 0 : 1;
int endPointLength = endPoint == null ? 0 : 1;

if (vertices.Length + endPointLength != 3)
type = PathType.BEZIER;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Rulesets/Objects/PathControlPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public PathControlPoint(Vector2 position, PathType? type = null)

public bool Equals(PathControlPoint other) => Position == other?.Position && Type == other.Type;

public override string ToString() => type is null
public override string ToString() => type == null
? $"Position={Position}"
: $"Position={Position}, Type={type}";
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Rulesets/Objects/SliderPathExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void Reverse(this SliderPath sliderPath, out Vector2 positionalOff
{
var controlPoints = sliderPath.ControlPoints;

var inheritedLinearPoints = controlPoints.Where(p => sliderPath.PointsInSegment(p)[0].Type == PathType.LINEAR && p.Type is null).ToList();
var inheritedLinearPoints = controlPoints.Where(p => sliderPath.PointsInSegment(p)[0].Type == PathType.LINEAR && p.Type == null).ToList();

// Inherited points after a linear point, as well as the first control point if it inherited,
// should be treated as linear points, so their types are temporarily changed to linear.
Expand All @@ -53,7 +53,7 @@ public static void Reverse(this SliderPath sliderPath, out Vector2 positionalOff
inheritedLinearPoints.ForEach(p => p.Type = null);

// Recalculate middle perfect curve control points at the end of the slider path.
if (controlPoints.Count >= 3 && controlPoints[^3].Type == PathType.PERFECT_CURVE && controlPoints[^2].Type is null && segmentEnds.Any())
if (controlPoints.Count >= 3 && controlPoints[^3].Type == PathType.PERFECT_CURVE && controlPoints[^2].Type == null && segmentEnds.Any())
{
double lastSegmentStart = segmentEnds.Length > 1 ? segmentEnds[^2] : 0;
double lastSegmentEnd = segmentEnds[^1];
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Rulesets/UI/ModIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void updateMod(IMod value)
modAcronym.Text = value.Acronym;
modIcon.Icon = value.Icon ?? FontAwesome.Solid.Question;

if (value.Icon is null)
if (value.Icon == null)
{
modIcon.FadeOut();
modAcronym.FadeIn();
Expand Down

0 comments on commit 94cbe18

Please sign in to comment.