Browse Source

some code cleanup

Brendan Forster 9 years ago
parent
commit
f9007228ca

+ 3 - 1
Ix.NET/Source/System.Interactive.Async/AsyncIterator.cs

@@ -27,7 +27,9 @@ namespace System.Linq
 
             public IAsyncEnumerator<TSource> GetEnumerator()
             {
-                var enumerator = state == AsyncIteratorState.New && threadId == Environment.CurrentManagedThreadId ? this : Clone();
+                var enumerator = state == AsyncIteratorState.New && threadId == Environment.CurrentManagedThreadId ?
+                    this :
+                    Clone();
 
                 enumerator.state = AsyncIteratorState.Allocated;
                 enumerator.cancellationTokenSource = new CancellationTokenSource();

+ 1 - 2
Ix.NET/Source/System.Interactive.Async/Catch.cs

@@ -228,8 +228,7 @@ namespace System.Linq
 
                         break; // case
                 }
-
-
+                
                 Dispose();
                 return false;
             }

+ 0 - 2
Ix.NET/Source/System.Interactive.Async/Concatenate.cs

@@ -47,7 +47,6 @@ namespace System.Linq
             return new ConcatEnumerableAsyncIterator<TSource>(sources);
         }
 
-
         private sealed class ConcatEnumerableAsyncIterator<TSource> : AsyncIterator<TSource>
         {
             private readonly IEnumerable<IAsyncEnumerable<TSource>> source;
@@ -127,7 +126,6 @@ namespace System.Linq
                         }
 
                         Dispose();
-
                         break;
                 }
 

+ 4 - 4
Ix.NET/Source/System.Interactive.Async/Count.cs

@@ -17,16 +17,16 @@ namespace System.Linq
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
 
-            var collectionoft = source as ICollection<TSource>;
-            if (collectionoft != null)
+            var collection = source as ICollection<TSource>;
+            if (collection != null)
             {
-                return Task.FromResult(collectionoft.Count);
+                return Task.FromResult(collection.Count);
             }
 
             var listProv = source as IIListProvider<TSource>;
             if (listProv != null)
             {
-                return listProv.GetCountAsync(onlyIfCheap: false, cancellationToken: cancellationToken);
+                return listProv.GetCountAsync(false, cancellationToken);
             }
 
             return source.Aggregate(0, (c, _) => checked(c + 1), cancellationToken);

+ 2 - 1
Ix.NET/Source/System.Interactive.Async/DefaultIfEmpty.cs

@@ -38,9 +38,10 @@ namespace System.Linq
 
             public DefaultIfEmptyAsyncIterator(IAsyncEnumerable<TSource> source, TSource defaultValue)
             {
+                Debug.Assert(source != null);
+
                 this.source = source;
                 this.defaultValue = defaultValue;
-                Debug.Assert(source != null);
             }
 
             public override AsyncIterator<TSource> Clone()

+ 1 - 1
Ix.NET/Source/System.Interactive.Async/Reverse.cs

@@ -67,7 +67,7 @@ namespace System.Linq
                     var listProv = source as IIListProvider<TSource>;
                     if (listProv != null)
                     {
-                        return listProv.GetCountAsync(onlyIfCheap: true, cancellationToken: cancellationToken);
+                        return listProv.GetCountAsync(onlyIfCheap, cancellationToken);
                     }
 
                     if (!(source is ICollection<TSource>) && !(source is ICollection))