Updated editorconfig to (mostly?) require braces around if/else statements, and applied the new formatting rules

This commit is contained in:
Kwoth
2022-02-02 01:44:45 +01:00
parent b22cd5a81e
commit ffa2c3f119
202 changed files with 2108 additions and 920 deletions

View File

@@ -6,7 +6,7 @@ public class EventPubSub : IPubSub
private readonly object _locker = new();
public Task Sub<TData>(in TypedKey<TData> key, Func<TData, ValueTask> action)
where TData: notnull
where TData : notnull
{
Func<object, ValueTask> localAction = obj => action((TData)obj);
lock (_locker)
@@ -30,7 +30,7 @@ public class EventPubSub : IPubSub
}
public Task Pub<TData>(in TypedKey<TData> key, TData data)
where TData: notnull
where TData : notnull
{
lock (_locker)
{
@@ -67,7 +67,8 @@ public class EventPubSub : IPubSub
// if our dictionary has no more elements after
// removing the entry
// it's safe to remove it from the key's subscriptions
if (actions.Count == 0) _actions.Remove(key.Key);
if (actions.Count == 0)
_actions.Remove(key.Key);
}
}

View File

@@ -3,7 +3,8 @@ namespace NadekoBot.Common;
public interface IPubSub
{
public Task Pub<TData>(in TypedKey<TData> key, TData data)
where TData: notnull;
where TData : notnull;
public Task Sub<TData>(in TypedKey<TData> key, Func<TData, ValueTask> action)
where TData: notnull;
where TData : notnull;
}

View File

@@ -7,7 +7,11 @@ public class JsonSeria : ISeria
{
private readonly JsonSerializerOptions _serializerOptions = new()
{
Converters = { new Rgba32Converter(), new CultureInfoConverter() }
Converters =
{
new Rgba32Converter(),
new CultureInfoConverter()
}
};
public byte[] Serialize<T>(T data)

View File

@@ -33,7 +33,7 @@ public sealed class RedisPubSub : IPubSub
try
{
var dataObj = _serializer.Deserialize<TData>(data);
if(dataObj is not null)
if (dataObj is not null)
await action(dataObj);
else
Log.Warning("Publishing event {EventName} with a null value. This is not allowed",