From 258de7a6fd138654b602f7467d3c40e65280d49e Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 28 Oct 2023 20:16:00 +0100 Subject: [PATCH] Fix RCS1179 --- .editorconfig | 3 +++ OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) 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 () => { }; } } }