From c4bd7a0b4e536ee2e7756398fdc85b6ee02420e7 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Fri, 19 Oct 2018 17:12:18 -0400 Subject: [PATCH] lint: use more performant algorithm, operate on StringBuilder --- src/Discord.Net.Rest/DiscordRestApiClient.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index e653a295e..7ed27531e 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -1,3 +1,4 @@ + #pragma warning disable CS1591 using Discord.API.Rest; using Discord.Net; @@ -1413,10 +1414,10 @@ namespace Discord.API lastIndex = rightIndex + 1; } + if (builder[builder.Length - 1] == '/') + builder.Remove(builder.Length - 1, 1); 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()); }