Skip to content

Commit fd838b2

Browse files
committed
Fixed some warnings
1 parent 565d947 commit fd838b2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

samples/Thinktecture.Runtime.Extensions.Samples/SmartEnums/SmartEnumDemos.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,18 @@ private static void DemoForNonValidatableEnum(ILogger logger)
136136

137137
var returnValue = productType.Switch(ProductType.Groceries, static () => "Switch with Func<T>: Groceries",
138138
ProductType.Housewares, static () => "Switch with Func<T>: Housewares");
139-
logger.Information(returnValue);
139+
logger.Information("{ReturnValue}", returnValue);
140140

141141
returnValue = productType.Switch(logger,
142142
ProductType.Groceries, static _ => "Switch with Func<T>: Groceries",
143143
ProductType.Housewares, static _ => "Switch with Func<T>: Housewares");
144144

145-
logger.Information(returnValue);
145+
logger.Information("{ReturnValue}", returnValue);
146146

147147
returnValue = productType.Map(ProductType.Groceries, "Map: Groceries",
148148
ProductType.Housewares, "Map: Housewares");
149149

150-
logger.Information(returnValue);
150+
logger.Information("{ReturnValue}", returnValue);
151151

152152
var parsed = ProductType.TryParse("Groceries", null, out var parsedProductType);
153153
logger.Information("Success: {Success} Parsed: {Parsed}", parsed, parsedProductType);

src/Thinktecture.Runtime.Extensions.MessagePack/Formatters/StructValueObjectMessagePackFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private static bool TryReadKey(
6565
return false;
6666
}
6767

68-
var formatter = options.Resolver.GetFormatterWithVerify<TKey>();
68+
var formatter = options.Resolver.GetFormatterWithVerify<TKey?>();
6969
key = formatter.Deserialize(ref reader, options);
7070

7171
return key is not null;

src/Thinktecture.Runtime.Extensions.MessagePack/Formatters/ValueObjectMessagePackFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void Serialize(ref MessagePackWriter writer, T? value, MessagePackSeriali
3535
if (reader.TryReadNil())
3636
return default;
3737

38-
var formatter = options.Resolver.GetFormatterWithVerify<TKey>();
38+
var formatter = options.Resolver.GetFormatterWithVerify<TKey?>();
3939
var key = formatter.Deserialize(ref reader, options);
4040

4141
if (key is null)

test/Thinktecture.Runtime.Extensions.Tests/ReadOnlyCollectionExtensions/ToReadOnlyCollection.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33
using System.Collections.Generic;
44
using System.Linq;
55

6+
#nullable enable
7+
68
namespace Thinktecture.Runtime.Tests.ReadOnlyCollectionExtensions;
79

810
public class ToReadOnlyCollection
911
{
1012
[Fact]
1113
public void Should_throw_if_items_is_null()
1214
{
13-
0.Invoking(_ => ((IReadOnlyCollection<int>)null)!.ToReadOnlyCollection(i => _))
14-
.Should().Throw<ArgumentNullException>();
15+
FluentActions.Invoking(() => ((IReadOnlyCollection<int>)null!).ToReadOnlyCollection(i => i))
16+
.Should().Throw<ArgumentNullException>();
1517
}
1618

1719
[Fact]
1820
public void Should_throw_if_count_is_negative()
1921
{
20-
Array.Empty<int>().Invoking(e => e.ToReadOnlyCollection((Func<int, int>)null))
22+
Array.Empty<int>().Invoking(e => e.ToReadOnlyCollection((Func<int, int>?)null!))
2123
.Should().Throw<ArgumentException>();
2224
}
2325

0 commit comments

Comments
 (0)