diff --git a/.editorconfig b/.editorconfig index f24baa6198..871961fb8c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1058,6 +1058,9 @@ dotnet_diagnostic.RCS1172.severity = warning # Unused 'this' parameter. dotnet_diagnostic.RCS1175.severity = warning +# Unnecessary assignment. +dotnet_diagnostic.RCS1179.severity = warning + # Use constant instead of field. dotnet_diagnostic.RCS1187.severity = warning diff --git a/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs index 0b607f15bd..e4a1a95499 100644 --- a/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs @@ -159,11 +159,10 @@ namespace OpenRA.Mods.Common.Scripting Action WrapOnPlayComplete(LuaFunction onPlayComplete) { - Action onComplete; if (onPlayComplete != null) { var f = (LuaFunction)onPlayComplete.CopyReference(); - onComplete = () => + return () => { try { @@ -177,9 +176,7 @@ namespace OpenRA.Mods.Common.Scripting }; } else - onComplete = () => { }; - - return onComplete; + return () => { }; } } }