Skip to content

Commit

Permalink
changed to string.Concat(params ReadOnlySpan<string?>)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulomorgado committed Jul 9, 2024
1 parent baa143a commit 643eeee
Showing 1 changed file with 2 additions and 48 deletions.
50 changes: 2 additions & 48 deletions src/Http/Http.Extensions/src/UriHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 6 in src/Http/Http.Extensions/src/UriHelper.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Http/Http.Extensions/src/UriHelper.cs#L6

src/Http/Http.Extensions/src/UriHelper.cs(6,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)
using System.Runtime.CompilerServices;

namespace Microsoft.AspNetCore.Http.Extensions;
Expand Down Expand Up @@ -203,54 +204,7 @@ public static string GetEncodedPathAndQuery(this HttpRequest request)
/// suitable only for display.</returns>
public static string GetDisplayUrl(this HttpRequest request)
{
var scheme = request.Scheme ?? string.Empty;
var host = request.Host.Value ?? string.Empty;
var pathBase = request.PathBase.Value ?? string.Empty;
var path = request.Path.Value ?? string.Empty;
var queryString = request.QueryString.Value ?? string.Empty;

var length = scheme.Length + SchemeDelimiter.Length + host.Length
+ pathBase.Length + path.Length + queryString.Length;

return string.Create(
length,
(scheme, host, pathBase, path, queryString),
static (buffer, uriParts) =>
{
var (scheme, host, pathBase, path, queryString) = uriParts;
if (scheme.Length > 0)
{
scheme.CopyTo(buffer);
buffer = buffer.Slice(scheme.Length);
}
SchemeDelimiter.CopyTo(buffer);
buffer = buffer.Slice(SchemeDelimiter.Length);
if (host.Length > 0)
{
host.CopyTo(buffer);
buffer = buffer.Slice(host.Length);
}
if (pathBase.Length > 0)
{
pathBase.CopyTo(buffer);
buffer = buffer.Slice(pathBase.Length);
}
if (path.Length > 0)
{
path.CopyTo(buffer);
buffer = buffer.Slice(path.Length);
}
if (queryString.Length > 0)
{
queryString.CopyTo(buffer);
}
});
return string.Concat((ReadOnlySpan<string?>)[request.Scheme, SchemeDelimiter, request.Host.Value, request.PathBase.Value, request.Path.Value, request.QueryString.Value]);
}

/// <summary>
Expand Down

0 comments on commit 643eeee

Please sign in to comment.