Visual Studio C#7 suggestions
This commit is contained in:
@@ -60,8 +60,7 @@ namespace Discord.Rest
|
||||
|
||||
public RestUser GetUser(ulong id)
|
||||
{
|
||||
RestGroupUser user;
|
||||
if (_users.TryGetValue(id, out user))
|
||||
if (_users.TryGetValue(id, out RestGroupUser user))
|
||||
return user;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -213,8 +213,7 @@ namespace Discord.Rest
|
||||
//Roles
|
||||
public RestRole GetRole(ulong id)
|
||||
{
|
||||
RestRole value;
|
||||
if (_roles.TryGetValue(id, out value))
|
||||
if (_roles.TryGetValue(id, out RestRole value))
|
||||
return value;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace Discord.Rest
|
||||
{
|
||||
if (Guild != null)
|
||||
return Guild;
|
||||
var guildChannel = Channel as IGuildChannel;
|
||||
if (guildChannel != null)
|
||||
if (Channel is IGuildChannel guildChannel)
|
||||
return guildChannel.Guild; //If it fails, it'll still return this exception
|
||||
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object.");
|
||||
}
|
||||
|
||||
@@ -80,8 +80,7 @@ namespace Discord.Rest
|
||||
if (endIndex == -1) break;
|
||||
string content = text.Substring(index, endIndex - index + 1);
|
||||
|
||||
ulong id;
|
||||
if (MentionUtils.TryParseUser(content, out id))
|
||||
if (MentionUtils.TryParseUser(content, out ulong id))
|
||||
{
|
||||
IUser mentionedUser = null;
|
||||
foreach (var mention in userMentions)
|
||||
|
||||
Reference in New Issue
Block a user