-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove redundant null initialisation and apply nullability
- Loading branch information
Showing
1 changed file
with
3 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using JetBrains.Annotations; | ||
using osu.Framework.Utils; | ||
using osu.Game.Rulesets.Difficulty; | ||
|
||
|
@@ -25,20 +22,18 @@ public readonly struct StarDifficulty | |
/// The difficulty attributes computed for the given beatmap. | ||
/// Might not be available if the star difficulty is associated with a beatmap that's not locally available. | ||
/// </summary> | ||
[CanBeNull] | ||
public readonly DifficultyAttributes DifficultyAttributes; | ||
public readonly DifficultyAttributes? DifficultyAttributes; | ||
|
||
/// <summary> | ||
/// The performance attributes computed for a perfect score on the given beatmap. | ||
/// Might not be available if the star difficulty is associated with a beatmap that's not locally available. | ||
/// </summary> | ||
[CanBeNull] | ||
public readonly PerformanceAttributes PerformanceAttributes; | ||
public readonly PerformanceAttributes? PerformanceAttributes; | ||
|
||
/// <summary> | ||
/// Creates a <see cref="StarDifficulty"/> structure. | ||
/// </summary> | ||
public StarDifficulty([NotNull] DifficultyAttributes difficulty, [NotNull] PerformanceAttributes performance) | ||
public StarDifficulty(DifficultyAttributes difficulty, PerformanceAttributes performance) | ||
{ | ||
Stars = double.IsFinite(difficulty.StarRating) ? difficulty.StarRating : 0; | ||
MaxCombo = difficulty.MaxCombo; | ||
|
@@ -55,7 +50,6 @@ public StarDifficulty(double starDifficulty, int maxCombo) | |
{ | ||
Stars = double.IsFinite(starDifficulty) ? starDifficulty : 0; | ||
MaxCombo = maxCombo; | ||
DifficultyAttributes = null; | ||
} | ||
|
||
public DifficultyRating DifficultyRating => GetDifficultyRating(Stars); | ||
|