More target-typed new and redundant paranthesis cleanup

This commit is contained in:
Kwoth
2021-12-20 00:33:11 +01:00
parent 345a9e9524
commit 1b2017024c
152 changed files with 573 additions and 580 deletions

View File

@@ -42,7 +42,7 @@ public class Help : NadekoModule<HelpService>
_client = client;
_strings = strings;
_lazyClientId = new AsyncLazy<ulong>(async () => (await _client.GetApplicationInfoAsync()).Id);
_lazyClientId = new(async () => (await _client.GetApplicationInfoAsync()).Id);
}
public async Task<SmartText> GetHelpString()
@@ -196,7 +196,7 @@ public class Help : NadekoModule<HelpService>
var succ = new HashSet<CommandInfo>();
if (opts.View != CommandsOptions.ViewType.All)
{
succ = new HashSet<CommandInfo>((await Task.WhenAll(cmds.Select(async x =>
succ = new((await Task.WhenAll(cmds.Select(async x =>
{
var pre = (await x.CheckPreconditionsAsync(Context, _services).ConfigureAwait(false));
return (Cmd: x, Succ: pre.IsSuccess);
@@ -360,7 +360,7 @@ public class Help : NadekoModule<HelpService>
var config = new AmazonS3Config {ServiceURL = serviceUrl};
using var dlClient = new AmazonS3Client(accessKey, secretAcccessKey, config);
var oldVersionObject = await dlClient.GetObjectAsync(new GetObjectRequest()
var oldVersionObject = await dlClient.GetObjectAsync(new()
{
BucketName = "nadeko-pictures",
Key = "cmds/versions.json",
@@ -368,7 +368,7 @@ public class Help : NadekoModule<HelpService>
using (var client = new AmazonS3Client(accessKey, secretAcccessKey, config))
{
await client.PutObjectAsync(new PutObjectRequest()
await client.PutObjectAsync(new()
{
BucketName = "nadeko-pictures",
ContentType = "application/json",
@@ -397,7 +397,7 @@ public class Help : NadekoModule<HelpService>
// upload the updated version list
using var client = new AmazonS3Client(accessKey, secretAcccessKey, config);
await client.PutObjectAsync(new PutObjectRequest()
await client.PutObjectAsync(new()
{
BucketName = "nadeko-pictures",
ContentType = "application/json",

View File

@@ -138,9 +138,9 @@ public class HelpService : ILateExecutor, INService
var userPermString = string.Empty;
if (userPerm is not null)
{
if (userPerm.UserPermissionAttribute.ChannelPermission is ChannelPermission cPerm)
if (userPerm.UserPermissionAttribute.ChannelPermission is { } cPerm)
userPermString = GetPreconditionString((ChannelPerm) cPerm);
if (userPerm.UserPermissionAttribute.GuildPermission is GuildPermission gPerm)
if (userPerm.UserPermissionAttribute.GuildPermission is { } gPerm)
userPermString = GetPreconditionString((GuildPerm) gPerm);
}