Removed redundant parenthesis

This commit is contained in:
Kwoth
2021-12-20 03:54:30 +01:00
parent edd60ae656
commit 9223d78849
58 changed files with 147 additions and 147 deletions

View File

@@ -13,6 +13,6 @@ public sealed class OwnerOnlyAttribute : PreconditionAttribute
{
var creds = services.GetRequiredService<IBotCredsProvider>().GetCreds();
return Task.FromResult((creds.IsOwner(context.User) || context.Client.CurrentUser.Id == context.User.Id ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner")));
return Task.FromResult(creds.IsOwner(context.User) || context.Client.CurrentUser.Id == context.User.Id ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner"));
}
}

View File

@@ -345,7 +345,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
Node previous = null;
for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
{
Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
Debug.Assert(previous is null && current == tables.Buckets[bucketNo] || previous.Next == current);
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
{
@@ -471,7 +471,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
Node previous = null;
for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
{
Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
Debug.Assert(previous is null && current == tables.Buckets[bucketNo] || previous.Next == current);
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
{
return false;

View File

@@ -27,7 +27,7 @@ public class DownloadTracker : INService
var added = LastDownloads.AddOrUpdate(
guild.Id,
now,
(key, old) => (now - old) > TimeSpan.FromHours(1) ? now : old);
(key, old) => now - old > TimeSpan.FromHours(1) ? now : old);
// means that this entry was just added - download the users
if (added == now)

View File

@@ -99,7 +99,7 @@ public abstract class NadekoModule : ModuleBase
{
dsc.MessageReceived += MessageReceived;
if ((await Task.WhenAny(userInputTask.Task, Task.Delay(10000)).ConfigureAwait(false)) != userInputTask.Task)
if (await Task.WhenAny(userInputTask.Task, Task.Delay(10000)).ConfigureAwait(false) != userInputTask.Task)
{
return null;
}

View File

@@ -36,7 +36,7 @@ public class NadekoRandom : Random
var bytes = new byte[sizeof(int)];
_rng.GetBytes(bytes);
var sign = Math.Sign(BitConverter.ToInt32(bytes, 0));
return (sign * BitConverter.ToInt32(bytes, 0)) % (maxValue - minValue) + minValue;
return sign * BitConverter.ToInt32(bytes, 0) % (maxValue - minValue) + minValue;
}
public long NextLong(long minValue, long maxValue)
@@ -48,7 +48,7 @@ public class NadekoRandom : Random
var bytes = new byte[sizeof(long)];
_rng.GetBytes(bytes);
var sign = Math.Sign(BitConverter.ToInt64(bytes, 0));
return (sign * BitConverter.ToInt64(bytes, 0)) % (maxValue - minValue) + minValue;
return sign * BitConverter.ToInt64(bytes, 0) % (maxValue - minValue) + minValue;
}
public override void NextBytes(byte[] buffer)

View File

@@ -10,7 +10,7 @@ public static class PlatformHelper
public static int ProcessorCount {
get {
var now = Environment.TickCount;
if (_processorCount == 0 || (now - _lastProcessorCountRefreshTicks) >= ProcessorCountRefreshIntervalMs)
if (_processorCount == 0 || now - _lastProcessorCountRefreshTicks >= ProcessorCountRefreshIntervalMs)
{
_processorCount = Environment.ProcessorCount;
_lastProcessorCountRefreshTicks = now;

View File

@@ -24,7 +24,7 @@ public sealed record SmartEmbedText : SmartText
!string.IsNullOrWhiteSpace(Url) ||
!string.IsNullOrWhiteSpace(Thumbnail) ||
!string.IsNullOrWhiteSpace(Image) ||
(Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) ||
Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl)) ||
Fields is { Length: > 0 };
public static SmartEmbedText FromEmbed(IEmbed eb, string plainText = null)

View File

@@ -37,7 +37,7 @@ public sealed class ShmartNumberTypeReader : NadekoTypeReader<ShmartNumber>
{
var expr = new NCalc.Expression(i, NCalc.EvaluateOptions.IgnoreCase);
expr.EvaluateParameter += (str, ev) => EvaluateParam(str, ev, context);
var lon = (long)(decimal.Parse(expr.Evaluate().ToString()));
var lon = (long)decimal.Parse(expr.Evaluate().ToString());
return TypeReaderResult.FromSuccess(new ShmartNumber(lon, input));
}
catch (Exception)