Skip to content

Commit 133f0a6

Browse files
committed
Cleanup. 3.2.0 preparation.
1 parent b6110b9 commit 133f0a6

File tree

11 files changed

+30
-31
lines changed

11 files changed

+30
-31
lines changed

Build/Props/CodeJam.Default.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<DelaySign>False</DelaySign>
1010
<AssemblyOriginatorKeyFile>..\Build\CodeJam.snk</AssemblyOriginatorKeyFile>
1111

12-
<Version>3.1.0.0</Version>
13-
<PackageVersion>3.1.0</PackageVersion>
12+
<Version>3.2.0.0</Version>
13+
<PackageVersion>3.2.0</PackageVersion>
1414
<PackageOutputPath>..\_Results</PackageOutputPath>
1515

1616
<Company>RSDN</Company>

CodeJam.Main/Assertions/ArgumentAssertion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// Builder type for argument assertions.
55
/// </summary>
66
/// <typeparam name="T">Type of the argument.</typeparam>
7-
public struct ArgumentAssertion<T>
7+
public readonly struct ArgumentAssertion<T>
88
{
99
/// <summary>
1010
/// Initialize instance.

CodeJam.Main/Collections/ComparerBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Linq;
55
using System.Linq.Expressions;
6+
// ReSharper disable once RedundantUsingDirective
67
using System.Reflection;
78

89
using JetBrains.Annotations;

CodeJam.Main/Collections/Enumerable/EnumerableExtensions.MinMaxBy.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ public static TSource MinBy<TSource, TValue>(
6868
Code.NotNull(source, nameof(source));
6969
Code.NotNull(selector, nameof(selector));
7070

71-
if (comparer == null)
72-
comparer = Comparer<TValue>.Default;
71+
comparer ??= Comparer<TValue>.Default;
7372

7473
var value = default(TValue);
7574
TSource item;
@@ -141,8 +140,7 @@ public static TSource MinByOrDefault<TSource, TValue>(
141140
Code.NotNull(source, nameof(source));
142141
Code.NotNull(selector, nameof(selector));
143142

144-
if (comparer == null)
145-
comparer = Comparer<TValue>.Default;
143+
comparer ??= Comparer<TValue>.Default;
146144

147145
var value = default(TValue);
148146
TSource item;
@@ -245,8 +243,7 @@ public static TSource MaxBy<TSource, TValue>(
245243
Code.NotNull(source, nameof(source));
246244
Code.NotNull(selector, nameof(selector));
247245

248-
if (comparer == null)
249-
comparer = Comparer<TValue>.Default;
246+
comparer ??= Comparer<TValue>.Default;
250247

251248
var value = default(TValue);
252249
TSource item;
@@ -318,8 +315,7 @@ public static TSource MaxByOrDefault<TSource, TValue>(
318315
Code.NotNull(source, nameof(source));
319316
Code.NotNull(selector, nameof(selector));
320317

321-
if (comparer == null)
322-
comparer = Comparer<TValue>.Default;
318+
comparer ??= Comparer<TValue>.Default;
323319

324320
var value = default(TValue);
325321
TSource item;

CodeJam.Main/Configuration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Diagnostics;
44
using System.IO;
55
using System.Threading;
6+
// ReSharper disable once RedundantUsingDirective
67
using System.Threading.Tasks;
78

89
using CodeJam.Threading;

CodeJam.Main/DisposableExtensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public static void DisposeAll([NotNull, ItemNotNull, InstantHandle] this IEnumer
2929
}
3030
catch (Exception ex)
3131
{
32-
if (exceptions == null)
33-
exceptions = new List<Exception>();
34-
32+
exceptions ??= new List<Exception>();
3533
exceptions.Add(ex);
3634
}
3735
}

CodeJam.Main/IO/TempData.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,9 @@ protected override void DisposePath([NotNull] string path, bool disposing)
218218
[NotNull]
219219
public static TempDirectory CreateDirectory([CanBeNull] string dirPath, [CanBeNull] string directoryName)
220220
{
221-
if (dirPath == null)
222-
dirPath = Path.GetTempPath();
221+
dirPath ??= Path.GetTempPath();
223222

224-
if (directoryName == null)
225-
directoryName = GetTempName();
223+
directoryName ??= GetTempName();
226224

227225
var directoryPath = Path.Combine(dirPath, directoryName);
228226
var result = new TempDirectory(directoryPath);
@@ -247,11 +245,9 @@ public static TempDirectory CreateDirectory([CanBeNull] string dirPath, [CanBeNu
247245
[NotNull]
248246
public static TempFile CreateFile([CanBeNull] string dirPath, [CanBeNull] string fileName)
249247
{
250-
if (dirPath == null)
251-
dirPath = Path.GetTempPath();
248+
dirPath ??= Path.GetTempPath();
252249

253-
if (fileName == null)
254-
fileName = GetTempName();
250+
fileName ??= GetTempName();
255251

256252
var filePath = Path.Combine(dirPath, fileName);
257253
var result = new TempFile(filePath);
@@ -288,11 +284,9 @@ public static FileStream CreateFileStream(
288284
{
289285
const int bufferSize = 4096;
290286

291-
if (dirPath == null)
292-
dirPath = Path.GetTempPath();
287+
dirPath ??= Path.GetTempPath();
293288

294-
if (fileName == null)
295-
fileName = GetTempName();
289+
fileName ??= GetTempName();
296290

297291
var filePath = Path.Combine(dirPath, fileName);
298292

CodeJam.Main/Readme.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
CodeJam 3.1.0 Release Notes
2-
-------------------------------
2+
---------------------------
3+
4+
What's new in 3.2.0
5+
-------------------
6+
* CreateSingle performance improvements
7+
* Additional Stream helper methods
8+
* Configuration API and retry policy for temporary data helpers
9+
* ToCompositeRangeExclusive method
10+
* StringBuilder IsNullOrEmpty/NotNullNorEmpty methods
11+
* ForEachAsync method
12+
* Refactoring, fixes and and code cleanup
313

414
What's new in 3.1.0
515
-------------------

CodeJam.Main/Reflection/AssemblyExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static class AssemblyExtensions
2424
public static bool IsDebugAssembly([NotNull] this Assembly assembly)
2525
{
2626
Code.NotNull(assembly, nameof(assembly));
27-
return assembly.GetCustomAttribute<System.Diagnostics.DebuggableAttribute>()?.IsJITOptimizerDisabled ?? false;
27+
return assembly.GetCustomAttribute<DebuggableAttribute>()?.IsJITOptimizerDisabled ?? false;
2828
}
2929
#endif
3030

CodeJam.Main/Structures/Option/Option`1.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ public bool Equals(Option<T> other)
9393
if (other == null)
9494
return false;
9595

96-
var thisSome = this as Some;
9796
var otherSome = other as Some;
9897

99-
if (ReferenceEquals(thisSome, null))
98+
if (!(this is Some))
10099
return ReferenceEquals(otherSome, null);
101100

102101
if (ReferenceEquals(otherSome, null))

0 commit comments

Comments
 (0)