Skip to content

Commit

Permalink
Update to .NET 7 RC1
Browse files Browse the repository at this point in the history
- Update to release candidate 1 of .NET 7.
- Fix compiler error.
- Apply two code simplifications suggested by Visual Studio.
  • Loading branch information
martincostello committed Oct 25, 2022
1 parent f0a4182 commit 8a0f30c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<PackageVersion Update="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(AssemblyName)' != 'JustEat.StatsD' ">
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0-preview.7.22375.6" />
<PackageVersion Update="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0-preview.7.22375.6" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0-rc.1.22426.10" />
<PackageVersion Update="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0-rc.1.22426.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" PrivateAssets="All" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.100-preview.7.22377.5",
"version": "7.0.100-rc.1.22431.12",
"allowPrerelease": false,
"rollForward": "latestMajor"
}
Expand Down
10 changes: 3 additions & 7 deletions src/JustEat.StatsD/TagsFormatters/StatsDTagsFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,20 @@ private bool TryWriteTags(ref Buffer<char> buffer, in Dictionary<string, string?

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private bool TryWriteTagsSeparator(ref Buffer<char> buffer, int index, in Dictionary<string, string?> tags) =>
!IsLastTag(index, tags)
? buffer.TryWrite(_tagsSeparator)
: true;
IsLastTag(index, tags) || buffer.TryWrite(_tagsSeparator);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool IsLastTag(int index, in Dictionary<string, string?> tags) =>
index == tags.Count - 1;

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private bool TryWriteTag(ref Buffer<char> buffer, in KeyValuePair<string, string?> tag) =>
private bool TryWriteTag(ref Buffer<char> buffer, KeyValuePair<string, string?> tag) =>
buffer.TryWriteString(tag.Key)
&& TryWriteTagValueIfNeeded(ref buffer, tag);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private bool TryWriteTagValueIfNeeded(ref Buffer<char> buffer, KeyValuePair<string, string?> tag) =>
tag.Value != null
? buffer.TryWrite(_keyValueSeparator) && buffer.TryWriteString(tag.Value!)
: true;
tag.Value == null || buffer.TryWrite(_keyValueSeparator) && buffer.TryWriteString(tag.Value!);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool AreTagsPresent(in Dictionary<string, string?>? tags) =>
Expand Down

0 comments on commit 8a0f30c

Please sign in to comment.