Skip to content

Commit 03235d5

Browse files
committed
Cleanup
1 parent ff09bae commit 03235d5

12 files changed

Lines changed: 29 additions & 12 deletions

File tree

CodeJam.Main/Collections/ComparerBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using System.Linq.Expressions;
66
using System.Reflection;
77

8-
// ReSharper disable once RedundantUsingDirective
9-
108
using JetBrains.Annotations;
119

1210
namespace CodeJam.Collections
@@ -150,6 +148,7 @@ private static Func<T, T, bool> CreateEqualsFunc([NotNull] IEnumerable<LambdaExp
150148
var mi = eq.GetMethods().Single(m => m.IsPublic && m.Name == "Equals" && m.GetParameters().Length == 2);
151149

152150
DebugCode.BugIf(pi is null, "pi != null");
151+
// ReSharper disable once AssignNullToNotNullAttribute
153152
return (Expression)Expression.Call(Expression.Property(null, pi), mi, arg0, arg1);
154153
});
155154

@@ -180,6 +179,7 @@ private static Func<T, int> CreateGetHashCodeFunc([NotNull] IEnumerable<LambdaEx
180179
DebugCode.BugIf(pi is null, "pi != null");
181180
return Expression.Add(
182181
Expression.Multiply(e, Expression.Constant(-1521134295)),
182+
// ReSharper disable once AssignNullToNotNullAttribute
183183
Expression.Call(Expression.Property(null, pi), mi, ma));
184184
});
185185

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
using JetBrains.Annotations;
44

5+
// ReSharper disable once CheckNamespace
56
namespace CodeJam.Collections.Backported
67
{
78
/// <summary>

CodeJam.Main/ConnectionStrings/ConnectionStringBase.ConnectionWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private class StringBuilderWrapper : DbConnectionStringBuilder
2424

2525
private static IReadOnlyDictionary<string, KeywordDescriptor> GetDescriptorsCore(Type type)
2626
{
27-
KeywordDescriptor GetDescriptor(PropertyInfo property) =>
27+
static KeywordDescriptor GetDescriptor(PropertyInfo property) =>
2828
new KeywordDescriptor(
2929
property.Name,
3030
property.PropertyType,

CodeJam.Main/ConnectionStrings/ConnectionStringBase.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public abstract partial class ConnectionStringBase : IDictionary<string, object>
1717
/// <summary>
1818
/// Descriptor for connection string keyword
1919
/// </summary>
20+
[PublicAPI]
2021
protected class KeywordDescriptor
2122
{
2223
/// <summary>
@@ -55,10 +56,8 @@ public KeywordDescriptor(string name, Type valueType, bool isRequired, bool isBr
5556

5657
/// <summary>Initializes a new instance of the <see cref="ConnectionStringBase" /> class.</summary>
5758
/// <param name="connectionString">The connection string.</param>
58-
protected ConnectionStringBase([CanBeNull] string connectionString)
59-
{
59+
protected ConnectionStringBase([CanBeNull] string connectionString) =>
6060
_wrapper = new StringBuilderWrapper(connectionString, GetType());
61-
}
6261

6362
/// <summary>
6463
/// Gets all supported keywords for current connection.

CodeJam.Main/DisposableExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Collections.Generic;
3+
#if NETSTANDARD21_OR_GREATER || NETCOREAPP30_OR_GREATER
34
using System.Threading.Tasks;
5+
#endif
46

57
using CodeJam.Internal;
68

CodeJam.Main/Expressions/ExpressionExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ void Action(MemberBinding b)
323323
VisitInternal(expr.Reduce(), func);
324324
break;
325325
}
326+
327+
default:
328+
break;
326329
}
327330

328331
func(expr);

CodeJam.Main/Ranges/[RangeExtensions]/CompositeRangeExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@ public static CompositeRange<T, TKey> ToCompositeRangeFrom<TSource, T, TKey>(
100100
{
101101
if (prevBoundary != rangeFrom)
102102
{
103-
foreach (var prevKey in prevKeys)
104-
ranges.Add(Range.Create(prevBoundary, rangeFrom.GetComplementation(), prevKey));
103+
ranges.AddRange(
104+
prevKeys.Select(prevKey => Range.Create(prevBoundary, rangeFrom.GetComplementation(), prevKey)));
105105
prevKeys.Clear();
106106
prevBoundary = rangeFrom;
107107
}
108108

109109
prevKeys.Add(key);
110110
}
111111

112-
foreach (var prevKey in prevKeys)
113-
ranges.Add(Range.Create(prevBoundary, RangeBoundaryTo<T>.PositiveInfinity, prevKey));
112+
ranges.AddRange(
113+
prevKeys.Select(prevKey => Range.Create(prevBoundary, RangeBoundaryTo<T>.PositiveInfinity, prevKey)));
114114

115115
return ranges.ToCompositeRange();
116116
}

CodeJam.Main/Readme.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
CodeJam 3.0.0-beta1 Release Notes
1+
CodeJam 3.0.0-beta3 Release Notes
22
---------------------------------
33

4+
What's new in 3.0.1-beta3
5+
-------------------------
6+
* IsAssignableTo() reflection helper.
7+
* Deconstruct methods for arrays, lists and enumerables (to support positional pattern).
8+
* Code cleanup
9+
410
What's new in 3.0.1-beta2
511
-------------------------
612
* Connection string parser/formatter class

CodeJam.Main/Reflection/TypeAccessorT.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace CodeJam.Reflection
1515
/// Provides fast access to type and its members.
1616
/// </summary>
1717
/// <typeparam name="T">Type to access.</typeparam>
18+
[PublicAPI]
1819
public class TypeAccessor<T> : TypeAccessor
1920
{
2021
static TypeAccessor()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public sealed class Some : Option<T>
155155
public sealed class None : Option<T>
156156
{
157157
[NotNull]
158-
internal static None Instance = new None();
158+
internal static readonly None Instance = new None();
159159

160160
private None() { }
161161

0 commit comments

Comments
 (0)