Skip to content

Commit 5fd94d0

Browse files
committed
Change: Cleanup
1 parent 91e6763 commit 5fd94d0

File tree

15 files changed

+31
-30
lines changed

15 files changed

+31
-30
lines changed

src/CodeOfChaos.Extensions.AspNetCore/LoggingFactoryExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public static class LoggingFactoryExtensions {
1818
/// <returns>An instance of <see cref="ILoggerFactory" /> configured with Serilog.</returns>
1919
public static ILoggerFactory CreateWithSerilog()
2020
=> LoggerFactory.Create(builder => builder.AddSerilog(Log.Logger));
21+
2122
/// <summary>
2223
/// Creates a new instance of <see cref="ILoggerFactory" /> configured with Serilog.
2324
/// </summary>

src/CodeOfChaos.Extensions.DependencyInjection/CodeOfChaos.Extensions.DependencyInjection.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<ItemGroup>
3131
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />
3232
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.3" />
33-
<PackageReference Include="System.Buffers" Version="4.6.0" />
3433
</ItemGroup>
3534

3635
</Project>

src/CodeOfChaos.Extensions/CollectionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ public static class CollectionExtensions {
1818
_ => !source.Any()
1919
};
2020

21-
public static bool IsCollectionEmpty<T>(this ICollection<T> collection) => collection.Count == 0;
21+
public static bool IsCollectionEmpty<T>(this ICollection<T> collection)
22+
=> collection.Count == 0;
2223
}

src/CodeOfChaos.Extensions/EnumExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ public static IEnumerable<T> GetFlags<T>(this T flagEnum, bool excludeZeroValue
4141
/// <summary>
4242
/// Retrieves all flagged values from the given Enum as an array.
4343
/// </summary>
44-
public static T[] GetFlagsAsArray<T>(this T flagEnum, bool excludeZeroValue = true) where T : struct, Enum => GetFlags(flagEnum, excludeZeroValue).ToArray();
44+
public static T[] GetFlagsAsArray<T>(this T flagEnum, bool excludeZeroValue = true) where T : struct, Enum
45+
=> GetFlags(flagEnum, excludeZeroValue).ToArray();
4546

4647
/// <summary>
4748
/// Retrieves all flagged values from the given Enum as a list.
4849
/// </summary>
49-
public static List<T> GetFlagsAsList<T>(this T flagEnum, bool excludeZeroValue = true) where T : struct, Enum => GetFlags(flagEnum, excludeZeroValue).ToList();
50+
public static List<T> GetFlagsAsList<T>(this T flagEnum, bool excludeZeroValue = true) where T : struct, Enum
51+
=> GetFlags(flagEnum, excludeZeroValue).ToList();
5052
}

src/CodeOfChaos.Extensions/ReflectionHelpers.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public static bool IsNullableReferenceType(this ParameterInfo parameter) {
2929
}
3030

3131
// WHY IS THIS SO EASY!
32-
public static bool IsNullableValueType(this ParameterInfo parameter) {
33-
return Nullable.GetUnderlyingType(parameter.ParameterType) != null;
34-
}
32+
public static bool IsNullableValueType(this ParameterInfo parameter)
33+
=> Nullable.GetUnderlyingType(parameter.ParameterType) != null;
3534

3635
}

src/CodeOfChaos.Extensions/StringExtensions.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,20 @@ namespace System;
1414
// Code
1515
// ---------------------------------------------------------------------------------------------------------------------
1616
public static class StringExtensions {
17-
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? str) => string.IsNullOrEmpty(str);
17+
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? str)
18+
=> string.IsNullOrEmpty(str);
1819

19-
public static bool IsNotNullOrEmpty([NotNullWhen(true)] this string? str) => !string.IsNullOrEmpty(str);
20+
public static bool IsNotNullOrEmpty([NotNullWhen(true)] this string? str)
21+
=> !string.IsNullOrEmpty(str);
2022

21-
public static bool IsNullOrWhiteSpace([NotNullWhen(false)] this string? str) => string.IsNullOrWhiteSpace(str);
23+
public static bool IsNullOrWhiteSpace([NotNullWhen(false)] this string? str)
24+
=> string.IsNullOrWhiteSpace(str);
2225

23-
public static bool IsNotNullOrWhiteSpace([NotNullWhen(true)] this string? str) => !string.IsNullOrWhiteSpace(str);
26+
public static bool IsNotNullOrWhiteSpace([NotNullWhen(true)] this string? str)
27+
=> !string.IsNullOrWhiteSpace(str);
2428

25-
public static string Truncate(this string input, int maxLength) => input.Length <= maxLength ? input : input[..maxLength];
29+
public static string Truncate(this string input, int maxLength)
30+
=> input.Length <= maxLength ? input : input[..maxLength];
2631

2732
public static Guid ToGuid(this string input) {
2833
#if DEBUG

src/CodeOfChaos.Extensions/TaskHelper.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,9 @@ public static class TaskHelper {
1919
return Task.FromResult<T?>(default);
2020
}
2121

22-
public static Task<T?> FromTaskOrDefault<T>(Task<T?>? originalTask, T? defaultValue) {
23-
if (originalTask != null) return originalTask;
24-
25-
return Task.FromResult(defaultValue);
26-
}
22+
public static Task<T?> FromTaskOrDefault<T>(Task<T?>? originalTask, T? defaultValue)
23+
=> originalTask ?? Task.FromResult(defaultValue);
2724

28-
public static Task<T?> FromTaskOrDefault<T>(Task<T?>? originalTask, Func<T?> defaultValueFactory) {
29-
if (originalTask != null) return originalTask;
30-
31-
return Task.FromResult(defaultValueFactory.Invoke());
32-
}
25+
public static Task<T?> FromTaskOrDefault<T>(Task<T?>? originalTask, Func<T?> defaultValueFactory)
26+
=> originalTask ?? Task.FromResult(defaultValueFactory.Invoke());
3327
}

tests/Tests.CodeOfChaos.Extensions.Analyzers/Tests.CodeOfChaos.Extensions.Analyzers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="CodeOfChaos.Testing.TUnit" Version="0.8.1" />
14-
<PackageReference Include="TUnit" Version="0.18.33" />
14+
<PackageReference Include="TUnit" Version="0.18.52" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

tests/Tests.CodeOfChaos.Extensions.AspNetCore/Tests.CodeOfChaos.Extensions.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<ItemGroup>
1414
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
1515
<PackageReference Include="Moq" Version="4.20.72"/>
16-
<PackageReference Include="TUnit" Version="0.18.33" />
16+
<PackageReference Include="TUnit" Version="0.18.52" />
1717
<PackageReference Include="Bogus" Version="35.6.2" />
1818
</ItemGroup>
1919

tests/Tests.CodeOfChaos.Extensions.DependencyInjection.Generators/Tests.CodeOfChaos.Extensions.DependencyInjection.Generators.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0" />
2020
<PackageReference Include="Moq" Version="4.20.72" />
2121
<PackageReference Include="System.Formats.Asn1" Version="9.0.3" />
22-
<PackageReference Include="TUnit" Version="0.18.33" />
22+
<PackageReference Include="TUnit" Version="0.18.52" />
2323
</ItemGroup>
2424

2525
<ItemGroup>

0 commit comments

Comments
 (0)