StyleCop clean Exts

This commit is contained in:
Matthias Mailänder
2013-08-04 08:31:49 +02:00
parent e6368b2b44
commit 0cfe7e2a06

View File

@@ -129,9 +129,9 @@ namespace OpenRA
return xs.Except(ys).Concat(ys.Except(xs)); return xs.Except(ys).Concat(ys.Except(xs));
} }
public static IEnumerable<T> Iterate<T>( this T t, Func<T,T> f ) public static IEnumerable<T> Iterate<T>(this T t, Func<T, T> f)
{ {
for(;;) { yield return t; t = f(t); } for (;;) { yield return t; t = f(t); }
} }
public static int NextPowerOf2(int v) public static int NextPowerOf2(int v)
@@ -157,7 +157,7 @@ namespace OpenRA
return string.Join(j, ts.Select(t => t.ToString()).ToArray()); return string.Join(j, ts.Select(t => t.ToString()).ToArray());
} }
public static IEnumerable<T> Append<T>( this IEnumerable<T> ts, params T[] moreTs) public static IEnumerable<T> Append<T>(this IEnumerable<T> ts, params T[] moreTs)
{ {
return ts.Concat(moreTs); return ts.Concat(moreTs);
} }
@@ -204,8 +204,8 @@ namespace OpenRA
// If any duplicates were found, log it and throw a descriptive error // If any duplicates were found, log it and throw a descriptive error
if (dupKeys.Count > 0) if (dupKeys.Count > 0)
{ {
string badKeysFormatted = String.Join(", ", dupKeys.Select(p => "{0}: [{1}]".F(logKey(p.Key), String.Join(",", p.Value.ToArray()))).ToArray()); var badKeysFormatted = string.Join(", ", dupKeys.Select(p => "{0}: [{1}]".F(logKey(p.Key), string.Join(",", p.Value.ToArray()))).ToArray());
string msg = "{0}, duplicate values found for the following keys: {1}".F(debugName, badKeysFormatted); var msg = "{0}, duplicate values found for the following keys: {1}".F(debugName, badKeysFormatted);
Log.Write("debug", msg); Log.Write("debug", msg);
throw new ArgumentException(msg); throw new ArgumentException(msg);
} }
@@ -240,7 +240,7 @@ namespace OpenRA
var result = 0; var result = 0;
foreach (var b in bits) foreach (var b in bits)
if (b) if (b)
result |= (1 << i++); result |= 1 << i++;
else else
i++; i++;
if (i > 33) if (i > 33)