chore: code cleanup (mostly whitespace / remove unused imports)

This commit is contained in:
spiral 2022-03-30 04:36:22 -04:00
parent 56155782c3
commit 7afba4ea95
No known key found for this signature in database
GPG key ID: 244A11E4B0BCF40E
29 changed files with 84 additions and 105 deletions

View file

@ -4,7 +4,7 @@ namespace PluralKit.Core;
public static class Proto
{
private static Dictionary<string, MessageParser> _parser = new();
private static readonly Dictionary<string, MessageParser> _parser = new();
public static byte[] Marshal(this IMessage message) => message.ToByteArray();
@ -12,11 +12,11 @@ public static class Proto
{
var type = typeof(T).ToString();
if (_parser.ContainsKey(type))
return (T)_parser[type].ParseFrom(message);
else
{
_parser.Add(type, new MessageParser<T>(() => new T()));
return Unmarshal<T>(message);
return (T)_parser[type].ParseFrom(message);
}
_parser.Add(type, new MessageParser<T>(() => new T()));
return Unmarshal<T>(message);
}
}