mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Fix warnings for using async without any await (#5532)
* Fix warnings for using async without any await * Fix async without await warning in EntityTypeParser * Fix async without await in EnumTypeParser * Update SessionTypeParser.cs * Update EntityTypeParser.cs * Update BoolTypeParser.cs * Update EntityTypeParser.cs * Update EnumTypeParser.cs * Update SessionTypeParser.cs * Fix compilation and formatting
This commit is contained in:
@@ -35,7 +35,8 @@ public sealed class BoolTypeParser : TypeParser<bool>
|
||||
result = true;
|
||||
error = null;
|
||||
return true;
|
||||
} else if (word == "false" || word == "f" || word == "0")
|
||||
}
|
||||
else if (word == "false" || word == "f" || word == "0")
|
||||
{
|
||||
result = false;
|
||||
error = null;
|
||||
@@ -49,9 +50,9 @@ public sealed class BoolTypeParser : TypeParser<bool>
|
||||
}
|
||||
}
|
||||
|
||||
public override async ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext, string? argName)
|
||||
public override ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext, string? argName)
|
||||
{
|
||||
return (CompletionResult.FromOptions(new[] {"true", "false"}), null);
|
||||
return new ValueTask<(CompletionResult?, IConError?)>((CompletionResult.FromOptions(new[] { "true", "false" }), null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ internal sealed class EntityTypeParser : TypeParser<EntityUid>
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext,
|
||||
public override ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext,
|
||||
string? argName)
|
||||
{
|
||||
return (CompletionResult.FromHint("<NetEntity>"), null);
|
||||
return new ValueTask<(CompletionResult?, IConError?)>((CompletionResult.FromHint("<NetEntity>"), null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ using Robust.Shared.Utility;
|
||||
namespace Robust.Shared.Toolshed.TypeParsers;
|
||||
|
||||
public sealed class EnumTypeParser<T> : TypeParser<T>
|
||||
where T: unmanaged, Enum
|
||||
where T : unmanaged, Enum
|
||||
{
|
||||
public override bool TryParse(ParserContext parserContext, [NotNullWhen(true)] out object? result,
|
||||
out IConError? error)
|
||||
@@ -46,14 +46,14 @@ public sealed class EnumTypeParser<T> : TypeParser<T>
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext, string? argName)
|
||||
public override ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext, string? argName)
|
||||
{
|
||||
return (CompletionResult.FromOptions(Enum.GetNames<T>()), null);
|
||||
return new ValueTask<(CompletionResult?, IConError?)>((CompletionResult.FromOptions(Enum.GetNames<T>()), null));
|
||||
}
|
||||
}
|
||||
|
||||
public record InvalidEnum<T>(string Value) : IConError
|
||||
where T: unmanaged, Enum
|
||||
where T : unmanaged, Enum
|
||||
{
|
||||
public FormattedMessage DescribeInner()
|
||||
{
|
||||
|
||||
@@ -43,11 +43,11 @@ internal sealed class SessionTypeParser : TypeParser<ICommonSession>
|
||||
return false;
|
||||
}
|
||||
|
||||
public override async ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext,
|
||||
public override ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext,
|
||||
string? argName)
|
||||
{
|
||||
var opts = CompletionHelper.SessionNames(true, _player);
|
||||
return (CompletionResult.FromHintOptions(opts, "<player session>"), null);
|
||||
return new ValueTask<(CompletionResult?, IConError?)>((CompletionResult.FromHintOptions(opts, "<player session>"), null));
|
||||
}
|
||||
|
||||
public record InvalidUsername(ILocalizationManager Loc, string Username) : IConError
|
||||
|
||||
Reference in New Issue
Block a user