From bf71ff513e062da8379a4e2c53b604877769a2ae Mon Sep 17 00:00:00 2001 From: martincostello Date: Thu, 10 Aug 2023 10:23:46 +0100 Subject: [PATCH] Fix-up branch - Fix packages after bad rebase. - Revert `scoped` changes after change to use C# 10. --- Directory.Packages.props | 2 +- src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs | 4 ++-- src/JustEat.StatsD/PublicAPI.Shipped.txt | 4 ++-- src/JustEat.StatsD/TagsFormatters/IStatsDTagsFormatter.cs | 2 +- src/JustEat.StatsD/TagsFormatters/NoOpTagsFormatter.cs | 2 +- src/JustEat.StatsD/TagsFormatters/StatsDTagsFormatter.cs | 2 +- tests/JustEat.StatsD.Tests/Utf8TagsFormatterTests.cs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8eae9ab5..ed53a014 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,7 +8,7 @@ - + diff --git a/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs b/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs index 4ad82836..880ab7aa 100644 --- a/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs +++ b/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs @@ -116,13 +116,13 @@ private int GetTagsBufferSize(in Dictionary? tags) => : 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryWriteBucketNameTagsIfNeeded(scoped ref Buffer buffer, in Dictionary? tags) => + private bool TryWriteBucketNameTagsIfNeeded(ref Buffer buffer, in Dictionary? tags) => !AreTagsPresent(tags) || _tagsFormatter.AreTrailing || buffer.TryWriteUtf8Chars(_tagsFormatter.FormatTags(tags!)); [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryWriteTrailingTagsIfNeeded(scoped ref Buffer buffer, in Dictionary? tags) => + private bool TryWriteTrailingTagsIfNeeded(ref Buffer buffer, in Dictionary? tags) => !AreTagsPresent(tags) || !_tagsFormatter.AreTrailing || buffer.TryWriteUtf8Chars(_tagsFormatter.FormatTags(tags!)); diff --git a/src/JustEat.StatsD/PublicAPI.Shipped.txt b/src/JustEat.StatsD/PublicAPI.Shipped.txt index 19e13e42..79481d13 100644 --- a/src/JustEat.StatsD/PublicAPI.Shipped.txt +++ b/src/JustEat.StatsD/PublicAPI.Shipped.txt @@ -57,7 +57,7 @@ JustEat.StatsD.TagsFormatter JustEat.StatsD.TagsFormatters.IStatsDTagsFormatter JustEat.StatsD.TagsFormatters.IStatsDTagsFormatter.AreTrailing.get -> bool JustEat.StatsD.TagsFormatters.IStatsDTagsFormatter.GetTagsBufferSize(in System.Collections.Generic.Dictionary! tags) -> int -JustEat.StatsD.TagsFormatters.IStatsDTagsFormatter.FormatTags(scoped in System.Collections.Generic.Dictionary! tags) -> System.ReadOnlySpan +JustEat.StatsD.TagsFormatters.IStatsDTagsFormatter.FormatTags(in System.Collections.Generic.Dictionary! tags) -> System.ReadOnlySpan JustEat.StatsD.TagsFormatters.StatsDTagsFormatter virtual JustEat.StatsD.TagsFormatters.StatsDTagsFormatter.AreTrailing.get -> bool JustEat.StatsD.TagsFormatters.StatsDTagsFormatter.StatsDTagsFormatter(JustEat.StatsD.TagsFormatters.StatsDTagsFormatterConfiguration! configuration) -> void @@ -116,4 +116,4 @@ static JustEat.StatsD.TimerExtensions.Time(this JustEat.StatsD.IStatsDPublish static JustEat.StatsD.TimerExtensions.Time(this JustEat.StatsD.IStatsDPublisher! publisher, string! bucket, System.Func!>! func, System.Collections.Generic.Dictionary? tags = null) -> System.Threading.Tasks.Task! static JustEat.StatsD.TimerExtensions.Time(this JustEat.StatsD.IStatsDPublisher! publisher, string! bucket, System.Func! func, System.Collections.Generic.Dictionary? tags = null) -> T virtual JustEat.StatsD.TagsFormatters.StatsDTagsFormatter.GetTagsBufferSize(in System.Collections.Generic.Dictionary! tags) -> int -virtual JustEat.StatsD.TagsFormatters.StatsDTagsFormatter.FormatTags(scoped in System.Collections.Generic.Dictionary! tags) -> System.ReadOnlySpan +virtual JustEat.StatsD.TagsFormatters.StatsDTagsFormatter.FormatTags(in System.Collections.Generic.Dictionary! tags) -> System.ReadOnlySpan diff --git a/src/JustEat.StatsD/TagsFormatters/IStatsDTagsFormatter.cs b/src/JustEat.StatsD/TagsFormatters/IStatsDTagsFormatter.cs index b0dc42b1..2112eba0 100644 --- a/src/JustEat.StatsD/TagsFormatters/IStatsDTagsFormatter.cs +++ b/src/JustEat.StatsD/TagsFormatters/IStatsDTagsFormatter.cs @@ -22,5 +22,5 @@ public interface IStatsDTagsFormatter /// /// The tag(s) included. /// The tag(s) formatted. - ReadOnlySpan FormatTags(scoped in Dictionary tags); + ReadOnlySpan FormatTags(in Dictionary tags); } diff --git a/src/JustEat.StatsD/TagsFormatters/NoOpTagsFormatter.cs b/src/JustEat.StatsD/TagsFormatters/NoOpTagsFormatter.cs index ec30c2ec..1cbe3d4f 100644 --- a/src/JustEat.StatsD/TagsFormatters/NoOpTagsFormatter.cs +++ b/src/JustEat.StatsD/TagsFormatters/NoOpTagsFormatter.cs @@ -6,5 +6,5 @@ internal sealed class NoOpTagsFormatter : IStatsDTagsFormatter public int GetTagsBufferSize(in Dictionary tags) => 0; - public ReadOnlySpan FormatTags(scoped in Dictionary tags) => ReadOnlySpan.Empty; + public ReadOnlySpan FormatTags(in Dictionary tags) => ReadOnlySpan.Empty; } diff --git a/src/JustEat.StatsD/TagsFormatters/StatsDTagsFormatter.cs b/src/JustEat.StatsD/TagsFormatters/StatsDTagsFormatter.cs index 4b9f94aa..beb316e1 100644 --- a/src/JustEat.StatsD/TagsFormatters/StatsDTagsFormatter.cs +++ b/src/JustEat.StatsD/TagsFormatters/StatsDTagsFormatter.cs @@ -65,7 +65,7 @@ public virtual int GetTagsBufferSize(in Dictionary tags) } /// - public virtual ReadOnlySpan FormatTags(scoped in Dictionary tags) + public virtual ReadOnlySpan FormatTags(in Dictionary tags) { if (!AreTagsPresent(tags)) { diff --git a/tests/JustEat.StatsD.Tests/Utf8TagsFormatterTests.cs b/tests/JustEat.StatsD.Tests/Utf8TagsFormatterTests.cs index 3daed7ba..a2248b24 100644 --- a/tests/JustEat.StatsD.Tests/Utf8TagsFormatterTests.cs +++ b/tests/JustEat.StatsD.Tests/Utf8TagsFormatterTests.cs @@ -298,6 +298,6 @@ private sealed class AlwaysNullStatsDTagsFormatter : IStatsDTagsFormatter public int GetTagsBufferSize(in Dictionary tags) => 0; - public ReadOnlySpan FormatTags(scoped in Dictionary tags) => null; + public ReadOnlySpan FormatTags(in Dictionary tags) => null; } }