Skip to content

Commit

Permalink
Ban == on span and use is to match constant string
Browse files Browse the repository at this point in the history
  • Loading branch information
huoyaoyuan committed Jul 9, 2024
1 parent d7a50d6 commit 9e44636
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CodeAnalysis/BannedSymbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ M:Humanizer.InflectorExtensions.Pascalize(System.String);Humanizer's .Pascalize(
M:Humanizer.InflectorExtensions.Camelize(System.String);Humanizer's .Camelize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToCamelCase() instead.
M:Humanizer.InflectorExtensions.Underscore(System.String);Humanizer's .Underscore() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToSnakeCase() instead.
M:Humanizer.InflectorExtensions.Kebaberize(System.String);Humanizer's .Kebaberize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToKebabCase() instead.
M:System.ReadOnlySpan`1.op_Equality(System.ReadOnlySpan`1,System.ReadOnlySpan`1)~System.Boolean;== on spans produces reference equality. Use SequenceEqual for value equality, or "is" to match ReadOnlySpan<char> with constant string.
2 changes: 1 addition & 1 deletion osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void handleGeneral(Storyboard storyboard, ReadOnlySpan<char> line)
switch (pair.Key)
{
case "UseSkinSprites":
storyboard.UseSkinSprites = pair.Value.SequenceEqual("1");
storyboard.UseSkinSprites = pair.Value is "1";
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Skinning/LegacyManiaSkinDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ private void flushPendingLines()
break;

case "JudgementLine":
currentConfig.ShowJudgementLine = pair.Value == "1";
currentConfig.ShowJudgementLine = pair.Value is "1";
break;

case "KeysUnderNotes":
currentConfig.KeysUnderNotes = pair.Value == "1";
currentConfig.KeysUnderNotes = pair.Value is "1";
break;

case "LightingNWidth":
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Skinning/LegacySkinDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override void ParseLine(SkinConfiguration skin, Section section, ReadO
return;

case @"Version":
if (pair.Value.SequenceEqual("latest"))
if (pair.Value is "latest")
skin.LegacyVersion = SkinConfiguration.LATEST_VERSION;
else if (decimal.TryParse(pair.Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out decimal version))
skin.LegacyVersion = version;
Expand Down

0 comments on commit 9e44636

Please sign in to comment.