OSDN Git Service

OpenTween v2.4.2 リリース
[opentween/open-tween.git] / OpenTween / ShortcutCommand.cs
index 235cc8c..86305e3 100644 (file)
@@ -19,6 +19,8 @@
 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
 // Boston, MA 02110-1301, USA.
 
+#nullable enable
+
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -67,7 +69,7 @@ namespace OpenTween
         private ShortcutCommand()
         {
             this.Shortcuts = Array.Empty<Keys>();
-            this.command = () => Task.FromResult(0);
+            this.command = () => Task.CompletedTask;
             this.onlyWhen = () => true;
             this.FocusedOn = FocusedControl.None;
             this.NotFocusedOn = FocusedControl.None;
@@ -166,14 +168,11 @@ namespace OpenTween
                 return this.instance;
             }
 
-            /// <summary>何もしないタスク</summary>
-            private static Task noOpTask = Task.FromResult(0);
-
             /// <summary>
             /// Action を Func&lt;Task&gt; に変換します
             /// </summary>
             private static Func<Task> SynchronousTask(Action action)
-                => () => { action(); return noOpTask; };
+                => () => { action(); return Task.CompletedTask; };
         }
     }
 }