Use out var syntax

This commit is contained in:
teinarss
2020-08-16 10:49:33 +02:00
committed by Paul Chote
parent d52e4793fe
commit 27f1a7ab27
193 changed files with 395 additions and 826 deletions

View File

@@ -89,9 +89,8 @@ namespace OpenRA.Mods.Common.Lint
var type = modData.ObjectCreator.FindType(widgetType + "Widget");
var keyNames = checkMethods.SelectMany(m => (IEnumerable<string>)type.GetMethod(m).Invoke(null, new object[] { node, emitError, emitWarning }));
Hotkey unused;
foreach (var name in keyNames)
if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out unused))
if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out var unused))
emitError("{0} refers to a Key named `{1}` that does not exist".F(node.Location, name));
}

View File

@@ -43,9 +43,8 @@ namespace OpenRA.Mods.Common.Lint
if (string.IsNullOrEmpty(notification))
continue;
SoundInfo soundInfo;
if (string.IsNullOrEmpty(type) || !rules.Notifications.TryGetValue(type.ToLowerInvariant(), out soundInfo) ||
!soundInfo.Notifications.ContainsKey(notification))
if (string.IsNullOrEmpty(type) || !rules.Notifications.TryGetValue(type.ToLowerInvariant(), out var soundInfo) ||
!soundInfo.Notifications.ContainsKey(notification))
emitError("Undefined notification reference {0}.{1} detected at {2} for {3}".F(
type ?? "(null)", notification, traitInfo.GetType().Name, actorInfo.Key));
}

View File

@@ -95,8 +95,7 @@ namespace OpenRA.Mods.Common.Lint
if (!playerNames.Contains(ownerName))
emitError("Actor {0} is owned by unknown player {1}.".F(kv.Key, ownerName));
RequiresSpecificOwnersInfo info;
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out info))
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out var info))
if (!info.ValidOwnerNames.Contains(ownerName))
emitError("Actor {0} owner {1} is not one of ValidOwnerNames: {2}".F(kv.Key, ownerName, info.ValidOwnerNames.JoinWith(", ")));
}