Browse Source

lint: use more performant algorithm, operate on StringBuilder

pull/1163/head
Christopher F 7 years ago
parent
commit
c4bd7a0b4e
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/Discord.Net.Rest/DiscordRestApiClient.cs

+ 3
- 2
src/Discord.Net.Rest/DiscordRestApiClient.cs View File

@@ -1,3 +1,4 @@

#pragma warning disable CS1591 #pragma warning disable CS1591
using Discord.API.Rest; using Discord.API.Rest;
using Discord.Net; using Discord.Net;
@@ -1413,10 +1414,10 @@ namespace Discord.API


lastIndex = rightIndex + 1; lastIndex = rightIndex + 1;
} }
if (builder[builder.Length - 1] == '/')
builder.Remove(builder.Length - 1, 1);


format = builder.ToString(); format = builder.ToString();
if (format.LastIndexOf('/') == format.Length-1)
format = format.Substring(0, format.Length - 1); // perf: change the code above so this isn't necessary


return x => string.Format(format, x.ToArray()); return x => string.Format(format, x.ToArray());
} }


Loading…
Cancel
Save