1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 17:27:24 +08:00

Apply some second-pass inspections that appeared after previous changes

This commit is contained in:
Dean Herbert 2021-10-27 13:09:30 +09:00
parent 6944151486
commit 95837990f3
6 changed files with 9 additions and 18 deletions

View File

@ -62,9 +62,7 @@ namespace osu.Game.Rulesets.Mania.MathUtils
if (i < j) if (i < j)
{ {
T key = keys[i]; (keys[i], keys[j]) = (keys[j], keys[i]);
keys[i] = keys[j];
keys[j] = key;
} }
i++; i++;
@ -142,11 +140,7 @@ namespace osu.Game.Rulesets.Mania.MathUtils
private static void swap(T[] a, int i, int j) private static void swap(T[] a, int i, int j)
{ {
if (i != j) if (i != j)
{ (a[i], a[j]) = (a[j], a[i]);
T t = a[i];
a[i] = a[j];
a[j] = t;
}
} }
private static void swapIfGreater(T[] keys, IComparer<T> comparer, int a, int b) private static void swapIfGreater(T[] keys, IComparer<T> comparer, int a, int b)
@ -154,11 +148,7 @@ namespace osu.Game.Rulesets.Mania.MathUtils
if (a != b) if (a != b)
{ {
if (comparer.Compare(keys[a], keys[b]) > 0) if (comparer.Compare(keys[a], keys[b]) > 0)
{ (keys[a], keys[b]) = (keys[b], keys[a]);
T key = keys[a];
keys[a] = keys[b];
keys[b] = key;
}
} }
} }
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
{ {
base.SetUpSteps(); base.SetUpSteps();
string[] expectedSampleNames = new[] string[] expectedSampleNames =
{ {
string.Empty, string.Empty,
string.Empty, string.Empty,
@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
HitSampleInfo.HIT_WHISTLE, HitSampleInfo.HIT_WHISTLE,
HitSampleInfo.HIT_WHISTLE, HitSampleInfo.HIT_WHISTLE,
}; };
var actualSampleNames = new List<string>(); var actualSampleNames = new List<string>();
// due to pooling we can't access all samples right away due to object re-use, // due to pooling we can't access all samples right away due to object re-use,

View File

@ -289,7 +289,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test] [Test]
public void TestSpectatingDuringGameplay() public void TestSpectatingDuringGameplay()
{ {
int[] players = new[] { PLAYER_1_ID, PLAYER_2_ID }; int[] players = { PLAYER_1_ID, PLAYER_2_ID };
start(players); start(players);
sendFrames(players, 300); sendFrames(players, 300);

View File

@ -156,7 +156,7 @@ namespace osu.Game.Database
void convertOnlineIDs<T>() where T : RealmObject void convertOnlineIDs<T>() where T : RealmObject
{ {
string? className = typeof(T).Name.Replace(@"Realm", string.Empty); string className = typeof(T).Name.Replace(@"Realm", string.Empty);
// version was not bumped when the beatmap/ruleset models were added // version was not bumped when the beatmap/ruleset models were added
// therefore we must manually check for their presence to avoid throwing on the `DynamicApi` calls. // therefore we must manually check for their presence to avoid throwing on the `DynamicApi` calls.

View File

@ -136,7 +136,7 @@ namespace osu.Game.Online.Chat
// length > 3 since all these links need another argument to work // length > 3 since all these links need another argument to work
if (args.Length > 3 && args[1].EndsWith(websiteRootUrl, StringComparison.OrdinalIgnoreCase)) if (args.Length > 3 && args[1].EndsWith(websiteRootUrl, StringComparison.OrdinalIgnoreCase))
{ {
string? mainArg = args[3]; string mainArg = args[3];
switch (args[2]) switch (args[2])
{ {

View File

@ -201,7 +201,7 @@ namespace osu.Game.Stores
{ {
try try
{ {
string[]? files = Directory.GetFiles(RuntimeInfo.StartupDirectory, @$"{ruleset_library_prefix}.*.dll"); string[] files = Directory.GetFiles(RuntimeInfo.StartupDirectory, @$"{ruleset_library_prefix}.*.dll");
foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests"))) foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
loadRulesetFromFile(file); loadRulesetFromFile(file);