From bc43db30c2857cce337650897f94d75024944fce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:38:11 +0900 Subject: [PATCH 01/11] Update c# language version to 10 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index a60c2c3c32..82c34a6d7b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - 8.0 + 10.0 true enable From d90d27acbafb9b58b798f3956edd76912f5a3389 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:38:22 +0900 Subject: [PATCH 02/11] Fix regression in `IHasCustomTooltip` disallowing struct usage --- osu.Framework/Graphics/Cursor/IHasCustomTooltip.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Framework/Graphics/Cursor/IHasCustomTooltip.cs b/osu.Framework/Graphics/Cursor/IHasCustomTooltip.cs index faf0fe0dc1..6e6f159c1d 100644 --- a/osu.Framework/Graphics/Cursor/IHasCustomTooltip.cs +++ b/osu.Framework/Graphics/Cursor/IHasCustomTooltip.cs @@ -27,7 +27,6 @@ public interface IHasCustomTooltip : ITooltipContentProvider /// public interface IHasCustomTooltip : IHasCustomTooltip - where TContent : class { ITooltip IHasCustomTooltip.GetCustomTooltip() => GetCustomTooltip(); From 7771197f52c4c40edce8b179a121f8c24c8ae820 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:41:50 +0900 Subject: [PATCH 03/11] Throw away all unused parameters --- .../Bindables/BindableBindingTest.cs | 10 +++++----- .../Bindables/BindableDictionaryTest.cs | 8 ++++---- osu.Framework.Tests/Bindables/BindableListTest.cs | 8 ++++---- .../Configuration/InputConfigManagerTest.cs | 6 +++--- .../Exceptions/TestLoadExceptions.cs | 6 +++--- .../Graphics/LifetimeEntryManagerTest.cs | 2 +- osu.Framework.Tests/IO/TestLogging.cs | 2 +- osu.Framework.Tests/IO/TestWebRequest.cs | 12 ++++++------ .../Transforms/TestSceneTransformEventBindings.cs | 2 +- .../Containers/TestSceneVisibilityContainer.cs | 2 +- .../Drawables/TestSceneCircularArcBoundingBox.cs | 2 +- .../Visual/Drawables/TestSceneComplexBlending.cs | 14 +++++++------- .../Visual/UserInterface/TestSceneCountingText.cs | 2 +- .../TestSceneFocusedOverlayContainer.cs | 2 +- .../Visual/UserInterface/TestScenePopover.cs | 2 +- .../Visual/UserInterface/TestSceneScreenStack.cs | 2 +- .../Visual/UserInterface/TestSceneTextBoxEvents.cs | 2 +- .../BackgroundDependencyLoaderAttribute.cs | 2 +- osu.Framework/Allocation/CachedAttribute.cs | 2 +- osu.Framework/Audio/Track/TrackBass.cs | 4 ++-- osu.Framework/Configuration/ConfigManager.cs | 2 +- .../Graphics/UserInterface/CircularProgress.cs | 2 +- osu.Framework/Graphics/UserInterface/Dropdown.cs | 2 +- osu.Framework/Graphics/Video/VideoDecoder.cs | 2 +- .../Handlers/Tablet/OpenTabletDriverHandler.cs | 2 +- .../Input/Handlers/Tablet/TabletDriver.cs | 6 +++--- osu.Framework/Platform/GameHost.cs | 2 +- osu.Framework/Platform/OsuTKWindow.cs | 14 +++++++------- osu.Framework/Testing/TestBrowser.cs | 2 +- osu.Framework/Threading/ThreadedTaskScheduler.cs | 2 +- 30 files changed, 64 insertions(+), 64 deletions(-) diff --git a/osu.Framework.Tests/Bindables/BindableBindingTest.cs b/osu.Framework.Tests/Bindables/BindableBindingTest.cs index 7ed542cb9b..110ddaefa1 100644 --- a/osu.Framework.Tests/Bindables/BindableBindingTest.cs +++ b/osu.Framework.Tests/Bindables/BindableBindingTest.cs @@ -111,7 +111,7 @@ public void TestDefaultChangedWithUpstreamRejection() int changed1 = 0, changed2 = 0; - bindable1.DefaultChanged += v => changed1++; + bindable1.DefaultChanged += _ => changed1++; bindable2.DefaultChanged += _ => { bindable2.Default = "won't change"; @@ -169,7 +169,7 @@ public void TestValueChangedWithUpstreamRejection() int changed1 = 0, changed2 = 0; - bindable1.ValueChanged += v => changed1++; + bindable1.ValueChanged += _ => changed1++; bindable2.ValueChanged += _ => { bindable2.Value = "won't change"; @@ -220,7 +220,7 @@ public void TestDisabledChangedWithUpstreamRejection() int changed1 = 0, changed2 = 0; - bindable1.DisabledChanged += v => changed1++; + bindable1.DisabledChanged += _ => changed1++; bindable2.DisabledChanged += _ => { bindable2.Disabled = false; @@ -269,7 +269,7 @@ public void TestMinValueChangedWithUpstreamRejection() int changed1 = 0, changed2 = 0; - bindable1.MinValueChanged += v => changed1++; + bindable1.MinValueChanged += _ => changed1++; bindable2.MinValueChanged += _ => { bindable2.MinValue = 1337; @@ -318,7 +318,7 @@ public void TestMaxValueChangedWithUpstreamRejection() int changed1 = 0, changed2 = 0; - bindable1.MaxValueChanged += v => changed1++; + bindable1.MaxValueChanged += _ => changed1++; bindable2.MaxValueChanged += _ => { bindable2.MaxValue = 1337; diff --git a/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs b/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs index b79d867db4..e23094190f 100644 --- a/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs +++ b/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs @@ -817,7 +817,7 @@ public void TestDisabledWhenSetToTrueNotifiesSubscribers() [Test] public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber() { - bindableStringByteDictionary.DisabledChanged += b => Assert.Fail(); + bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail(); bindableStringByteDictionary.Disabled = bindableStringByteDictionary.Disabled; } @@ -825,9 +825,9 @@ public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber() [Test] public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscribers() { - bindableStringByteDictionary.DisabledChanged += b => Assert.Fail(); - bindableStringByteDictionary.DisabledChanged += b => Assert.Fail(); - bindableStringByteDictionary.DisabledChanged += b => Assert.Fail(); + bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail(); + bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail(); + bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail(); bindableStringByteDictionary.Disabled = bindableStringByteDictionary.Disabled; } diff --git a/osu.Framework.Tests/Bindables/BindableListTest.cs b/osu.Framework.Tests/Bindables/BindableListTest.cs index c0e17b3579..dc60ea921b 100644 --- a/osu.Framework.Tests/Bindables/BindableListTest.cs +++ b/osu.Framework.Tests/Bindables/BindableListTest.cs @@ -1279,7 +1279,7 @@ public void TestDisabledWhenSetToTrueNotifiesSubscribers() [Test] public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber() { - bindableStringList.DisabledChanged += b => Assert.Fail(); + bindableStringList.DisabledChanged += _ => Assert.Fail(); bindableStringList.Disabled = bindableStringList.Disabled; } @@ -1287,9 +1287,9 @@ public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber() [Test] public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscribers() { - bindableStringList.DisabledChanged += b => Assert.Fail(); - bindableStringList.DisabledChanged += b => Assert.Fail(); - bindableStringList.DisabledChanged += b => Assert.Fail(); + bindableStringList.DisabledChanged += _ => Assert.Fail(); + bindableStringList.DisabledChanged += _ => Assert.Fail(); + bindableStringList.DisabledChanged += _ => Assert.Fail(); bindableStringList.Disabled = bindableStringList.Disabled; } diff --git a/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs b/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs index 368097bac5..34442f3d60 100644 --- a/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs +++ b/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs @@ -44,7 +44,7 @@ public void TestOldConfigPersists() using (var host = new TestHeadlessGameHost()) { - host.Run(new TestGame((h, config) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value)); + host.Run(new TestGame((h, _) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value)); } Assert.AreEqual(5, sensitivity); @@ -55,7 +55,7 @@ public void TestNewConfigPersists() { using (var host = new TestHeadlessGameHost(bypassCleanup: true)) { - host.Run(new TestGame((h, config) => + host.Run(new TestGame((h, _) => { storage = h.Storage; h.AvailableInputHandlers.OfType().First().Sensitivity.Value = 5; @@ -69,7 +69,7 @@ public void TestNewConfigPersists() using (var host = new TestHeadlessGameHost()) { - host.Run(new TestGame((h, config) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value)); + host.Run(new TestGame((h, _) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value)); } Assert.AreEqual(5, sensitivity); diff --git a/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs b/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs index af8e430c72..434d87f60d 100644 --- a/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs +++ b/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs @@ -104,7 +104,7 @@ public void TestSingleAsyncAdd() { g.Add(loadTarget); loadTarget.PerformAsyncLoad(); - }, g => loadable.Parent == loadTarget); + }, _ => loadable.Parent == loadTarget); }); } @@ -121,7 +121,7 @@ public void TestDoubleAsyncLoad() g.Add(loadTarget); loadTarget.PerformAsyncLoad(); loadTarget.PerformAsyncLoad(false); - }, g => loadable.Parent == loadTarget); + }, _ => loadable.Parent == loadTarget); }); } @@ -209,7 +209,7 @@ public void TestDisposeAfterLoad() runGameWithLogic(g => { g.Add(loadTarget); - loadTarget.PerformAsyncLoad().ContinueWith(t => allowDispose = true); + loadTarget.PerformAsyncLoad().ContinueWith(_ => allowDispose = true); }, g => { // The following code is done here for a very specific reason, but can occur naturally in normal use diff --git a/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs b/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs index 2c5a5adf0c..2e7a3e4ca4 100644 --- a/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs +++ b/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs @@ -209,7 +209,7 @@ public void TestFuzz() addEntry(); - manager.EntryCrossedBoundary += (entry, kind, direction) => changeLifetime(); + manager.EntryCrossedBoundary += (_, _, _) => changeLifetime(); manager.Update(0); int count = 1; diff --git a/osu.Framework.Tests/IO/TestLogging.cs b/osu.Framework.Tests/IO/TestLogging.cs index 65b31af74a..2759ecd32b 100644 --- a/osu.Framework.Tests/IO/TestLogging.cs +++ b/osu.Framework.Tests/IO/TestLogging.cs @@ -100,7 +100,7 @@ private void runWithIgnoreCount(int ignoreCount, int fireCount) { using (var host = new TestRunHeadlessGameHost()) { - host.ExceptionThrown += ex => ignoreCount-- > 0; + host.ExceptionThrown += _ => ignoreCount-- > 0; var game = new TestGame(); diff --git a/osu.Framework.Tests/IO/TestWebRequest.cs b/osu.Framework.Tests/IO/TestWebRequest.cs index 1b386be070..417ab837c8 100644 --- a/osu.Framework.Tests/IO/TestWebRequest.cs +++ b/osu.Framework.Tests/IO/TestWebRequest.cs @@ -523,9 +523,9 @@ public void TestEventUnbindOnCompletion([Values(true, false)] bool async) }; request.Started += () => { }; - request.Failed += e => { }; - request.DownloadProgress += (l1, l2) => { }; - request.UploadProgress += (l1, l2) => { }; + request.Failed += _ => { }; + request.DownloadProgress += (_, _) => { }; + request.UploadProgress += (_, _) => { }; Assert.DoesNotThrow(request.Perform); @@ -553,9 +553,9 @@ public void TestUnbindOnDispose([Values(true, false)] bool async) using (request) { request.Started += () => { }; - request.Failed += e => { }; - request.DownloadProgress += (l1, l2) => { }; - request.UploadProgress += (l1, l2) => { }; + request.Failed += _ => { }; + request.DownloadProgress += (_, _) => { }; + request.UploadProgress += (_, _) => { }; Assert.DoesNotThrow(request.Perform); } diff --git a/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs b/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs index e4a885536e..b924823585 100644 --- a/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs +++ b/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs @@ -43,7 +43,7 @@ public void TestOnCompleteBindingImmediateExecution() Child = container = new Container(); completedFired = 0; - container.FadeIn(500).Then().FadeOut().OnComplete(a => { completedFired++; }); + container.FadeIn(500).Then().FadeOut().OnComplete(_ => { completedFired++; }); }); AddAssert("not immediately fired", () => completedFired == 0); diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs index a380c3cced..9ecb0f8dbf 100644 --- a/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs +++ b/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs @@ -188,7 +188,7 @@ public TestVisibilityContainer(bool? startHidden = true, Color4? colour = null) }, }; - State.ValueChanged += e => FireCount++; + State.ValueChanged += _ => FireCount++; } public int FireCount { get; private set; } diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs index b7059ce401..35f04d5478 100644 --- a/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs +++ b/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs @@ -68,7 +68,7 @@ private void load() protected override void LoadComplete() { - controlPoints.BindCollectionChanged((_, __) => + controlPoints.BindCollectionChanged((_, _) => { var copy = controlPoints.ToArray(); if (copy.Length != 3) diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs index 09b261c930..484cec3d2f 100644 --- a/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs +++ b/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs @@ -227,13 +227,13 @@ public TestSceneComplexBlending() blendingAlphaSrcDropdown.Current.Value = BlendingType.One; blendingAlphaDestDropdown.Current.Value = BlendingType.One; - colourModeDropdown.Current.ValueChanged += v => updateBlending(); - colourEquation.Current.ValueChanged += v => updateBlending(); - alphaEquation.Current.ValueChanged += v => updateBlending(); - blendingSrcDropdown.Current.ValueChanged += v => updateBlending(); - blendingDestDropdown.Current.ValueChanged += v => updateBlending(); - blendingAlphaSrcDropdown.Current.ValueChanged += v => updateBlending(); - blendingAlphaDestDropdown.Current.ValueChanged += v => updateBlending(); + colourModeDropdown.Current.ValueChanged += _ => updateBlending(); + colourEquation.Current.ValueChanged += _ => updateBlending(); + alphaEquation.Current.ValueChanged += _ => updateBlending(); + blendingSrcDropdown.Current.ValueChanged += _ => updateBlending(); + blendingDestDropdown.Current.ValueChanged += _ => updateBlending(); + blendingAlphaSrcDropdown.Current.ValueChanged += _ => updateBlending(); + blendingAlphaDestDropdown.Current.ValueChanged += _ => updateBlending(); } private void switchToCustomBlending() diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneCountingText.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneCountingText.cs index b750d0f4d1..f89b835a6d 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneCountingText.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneCountingText.cs @@ -37,7 +37,7 @@ public TestSceneCountingText() typeDropdown.Items = (CountType[])Enum.GetValues(typeof(CountType)); countType.BindTo(typeDropdown.Current); - countType.ValueChanged += v => beginStep(lastStep)(); + countType.ValueChanged += _ => beginStep(lastStep)(); AddStep("1 -> 4 | 1 sec", beginStep(() => counter.CountTo(1).CountTo(4, 1000))); AddStep("1 -> 4 | 3 sec", beginStep(() => counter.CountTo(1).CountTo(4, 3000))); diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneFocusedOverlayContainer.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneFocusedOverlayContainer.cs index 9052040163..9307861829 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneFocusedOverlayContainer.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneFocusedOverlayContainer.cs @@ -123,7 +123,7 @@ public TestFocusedOverlayContainer(bool startHidden = true, bool blockScrollInpu }, }; - State.ValueChanged += e => FireCount++; + State.ValueChanged += _ => FireCount++; } public int FireCount { get; private set; } diff --git a/osu.Framework.Tests/Visual/UserInterface/TestScenePopover.cs b/osu.Framework.Tests/Visual/UserInterface/TestScenePopover.cs index ea4a06f08f..dc72e5b31a 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestScenePopover.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestScenePopover.cs @@ -31,7 +31,7 @@ public void TestSimpleText() => createContent((anchor, popover) => }); [Test] - public void TestSizingDirectly() => createContent((anchor, popover) => + public void TestSizingDirectly() => createContent((_, popover) => { popover.Size = new Vector2(200, 100); diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneScreenStack.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneScreenStack.cs index a9fe646863..f99a53e95f 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneScreenStack.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneScreenStack.cs @@ -42,7 +42,7 @@ public void SetupTest() => Schedule(() => RelativeSizeAxes = Axes.Both }); - stack.ScreenPushed += (last, current) => + stack.ScreenPushed += (_, current) => { if (current is TestScreenSlow slow) slowLoaders.Add(slow); diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneTextBoxEvents.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneTextBoxEvents.cs index a8b62ec50f..8c91e03fa0 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneTextBoxEvents.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneTextBoxEvents.cs @@ -57,7 +57,7 @@ public void SetUpSteps() [Test] public void TestCommitIsNewTextSecondTime() { - AddStep("add handler to reset on commit", () => textBox.OnCommit += (sender, isNew) => + AddStep("add handler to reset on commit", () => textBox.OnCommit += (_, isNew) => { if (!isNew) return; diff --git a/osu.Framework/Allocation/BackgroundDependencyLoaderAttribute.cs b/osu.Framework/Allocation/BackgroundDependencyLoaderAttribute.cs index c9da4960cc..dc4396e189 100644 --- a/osu.Framework/Allocation/BackgroundDependencyLoaderAttribute.cs +++ b/osu.Framework/Allocation/BackgroundDependencyLoaderAttribute.cs @@ -47,7 +47,7 @@ internal static InjectDependencyDelegate CreateActivator(Type type) switch (loaderMethods.Length) { case 0: - return (_, __) => { }; + return (_, _) => { }; case 1: var method = loaderMethods[0]; diff --git a/osu.Framework/Allocation/CachedAttribute.cs b/osu.Framework/Allocation/CachedAttribute.cs index c7b1648b63..6d627222d2 100644 --- a/osu.Framework/Allocation/CachedAttribute.cs +++ b/osu.Framework/Allocation/CachedAttribute.cs @@ -141,7 +141,7 @@ internal static CacheDependencyDelegate CreateActivator(Type type) additionActivators.AddRange(createMemberActivator(field, type, allowValueTypes)); if (additionActivators.Count == 0) - return (_, existing, info) => existing; + return (_, existing, _) => existing; return (target, existing, info) => { diff --git a/osu.Framework/Audio/Track/TrackBass.cs b/osu.Framework/Audio/Track/TrackBass.cs index 5b865d4e02..86d4bf1def 100644 --- a/osu.Framework/Audio/Track/TrackBass.cs +++ b/osu.Framework/Audio/Track/TrackBass.cs @@ -371,8 +371,8 @@ private void initializeSyncs() && endCallback == null && endSync == null); - stopCallback = new SyncCallback((a, b, c, d) => RaiseFailed()); - endCallback = new SyncCallback((a, b, c, d) => + stopCallback = new SyncCallback((_, _, _, _) => RaiseFailed()); + endCallback = new SyncCallback((_, _, _, _) => { if (Looping) { diff --git a/osu.Framework/Configuration/ConfigManager.cs b/osu.Framework/Configuration/ConfigManager.cs index 6621d9300f..b096100221 100644 --- a/osu.Framework/Configuration/ConfigManager.cs +++ b/osu.Framework/Configuration/ConfigManager.cs @@ -311,7 +311,7 @@ protected void QueueBackgroundSave() { int current = Interlocked.Increment(ref lastSave); - Task.Delay(100).ContinueWith(task => + Task.Delay(100).ContinueWith(_ => { if (current == lastSave) Save(); }); diff --git a/osu.Framework/Graphics/UserInterface/CircularProgress.cs b/osu.Framework/Graphics/UserInterface/CircularProgress.cs index 58a52cf4aa..69bdefdfb0 100644 --- a/osu.Framework/Graphics/UserInterface/CircularProgress.cs +++ b/osu.Framework/Graphics/UserInterface/CircularProgress.cs @@ -24,7 +24,7 @@ public Bindable Current public CircularProgress() { - Current.ValueChanged += newValue => Invalidate(Invalidation.DrawNode); + Current.ValueChanged += _ => Invalidate(Invalidation.DrawNode); } public IShader RoundedTextureShader { get; private set; } diff --git a/osu.Framework/Graphics/UserInterface/Dropdown.cs b/osu.Framework/Graphics/UserInterface/Dropdown.cs index 55d9747010..2fc54316cc 100644 --- a/osu.Framework/Graphics/UserInterface/Dropdown.cs +++ b/osu.Framework/Graphics/UserInterface/Dropdown.cs @@ -225,7 +225,7 @@ protected Dropdown() Menu.State = MenuState.Closed; }; - ItemSource.CollectionChanged += (_, __) => setItems(ItemSource); + ItemSource.CollectionChanged += (_, _) => setItems(ItemSource); } private void preselectionConfirmed(int selectedIndex) diff --git a/osu.Framework/Graphics/Video/VideoDecoder.cs b/osu.Framework/Graphics/Video/VideoDecoder.cs index b0063c63dc..25a8570318 100644 --- a/osu.Framework/Graphics/Video/VideoDecoder.cs +++ b/osu.Framework/Graphics/Video/VideoDecoder.cs @@ -148,7 +148,7 @@ public VideoDecoder(Stream videoStream) availableTextures = new ConcurrentQueue(); // TODO: use "real" object pool when there's some public pool supporting disposables handle = new ObjectHandle(this, GCHandleType.Normal); - TargetHardwareVideoDecoders.BindValueChanged(e => + TargetHardwareVideoDecoders.BindValueChanged(_ => { // ignore if decoding wasn't initialized yet. if (formatContext == null) diff --git a/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs b/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs index 2b32cfb356..3548442720 100644 --- a/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs +++ b/osu.Framework/Input/Handlers/Tablet/OpenTabletDriverHandler.cs @@ -55,7 +55,7 @@ public override bool Initialize(GameHost host) if (d.NewValue && tabletDriver == null) { tabletDriver = TabletDriver.Create(); - tabletDriver.TabletsChanged += (s, e) => + tabletDriver.TabletsChanged += (_, e) => { device = e.Any() ? tabletDriver.InputDevices.First() : null; diff --git a/osu.Framework/Input/Handlers/Tablet/TabletDriver.cs b/osu.Framework/Input/Handlers/Tablet/TabletDriver.cs index 7b877cf09d..ccfe92cd7b 100644 --- a/osu.Framework/Input/Handlers/Tablet/TabletDriver.cs +++ b/osu.Framework/Input/Handlers/Tablet/TabletDriver.cs @@ -31,9 +31,9 @@ public sealed class TabletDriver : Driver public TabletDriver([NotNull] ICompositeDeviceHub deviceHub, [NotNull] IReportParserProvider reportParserProvider, [NotNull] IDeviceConfigurationProvider configurationProvider) : base(deviceHub, reportParserProvider, configurationProvider) { - Log.Output += (sender, logMessage) => Logger.Log($"{logMessage.Group}: {logMessage.Message}", level: (LogLevel)logMessage.Level); + Log.Output += (_, logMessage) => Logger.Log($"{logMessage.Group}: {logMessage.Message}", level: (LogLevel)logMessage.Level); - deviceHub.DevicesChanged += (sender, args) => + deviceHub.DevicesChanged += (_, args) => { // it's worth noting that this event fires on *any* device change system-wide, including non-tablet devices. if (!Tablets.Any() && args.Additions.Any()) @@ -64,7 +64,7 @@ private async Task detectAsync(CancellationToken cancellationToken) foreach (var endpoint in device.InputDevices) { endpoint.Report += DeviceReported; - endpoint.ConnectionStateChanged += (sender, connected) => + endpoint.ConnectionStateChanged += (_, connected) => { if (!connected) endpoint.Report -= DeviceReported; diff --git a/osu.Framework/Platform/GameHost.cs b/osu.Framework/Platform/GameHost.cs index 8d8c9786ec..02a820b90a 100644 --- a/osu.Framework/Platform/GameHost.cs +++ b/osu.Framework/Platform/GameHost.cs @@ -750,7 +750,7 @@ public void Run(Game game) break; case OsuTKWindow tkWindow: - tkWindow.UpdateFrame += (o, e) => windowUpdate(); + tkWindow.UpdateFrame += (_, _) => windowUpdate(); break; } diff --git a/osu.Framework/Platform/OsuTKWindow.cs b/osu.Framework/Platform/OsuTKWindow.cs index 7607ae6a1e..cf32216b79 100644 --- a/osu.Framework/Platform/OsuTKWindow.cs +++ b/osu.Framework/Platform/OsuTKWindow.cs @@ -113,28 +113,28 @@ protected OsuTKWindow([NotNull] IGameWindow osuTKGameWindow) // Moving or resizing the window needs to check to see if we've moved to a different display. // This will update the CurrentDisplay bindable. - Move += (sender, e) => checkCurrentDisplay(); - Resize += (sender, e) => + Move += (_, _) => checkCurrentDisplay(); + Resize += (_, _) => { checkCurrentDisplay(); Resized?.Invoke(); }; - Closing += (sender, e) => + Closing += (_, e) => { // always block a graceful exit as it's treated as a regular window event. // the host will force-close the window if the game decides not to block the exit. ExitRequested?.Invoke(); e.Cancel = true; }; - Closed += (sender, e) => Exited?.Invoke(); + Closed += (_, _) => Exited?.Invoke(); - MouseEnter += (sender, args) => cursorInWindow.Value = true; - MouseLeave += (sender, args) => cursorInWindow.Value = false; + MouseEnter += (_, _) => cursorInWindow.Value = true; + MouseLeave += (_, _) => cursorInWindow.Value = false; supportedWindowModes.AddRange(DefaultSupportedWindowModes); - UpdateFrame += (o, e) => UpdateFrameScheduler.Update(); + UpdateFrame += (_, _) => UpdateFrameScheduler.Update(); MakeCurrent(); diff --git a/osu.Framework/Testing/TestBrowser.cs b/osu.Framework/Testing/TestBrowser.cs index 7d95ac3690..746535a218 100644 --- a/osu.Framework/Testing/TestBrowser.cs +++ b/osu.Framework/Testing/TestBrowser.cs @@ -248,7 +248,7 @@ private void load(Storage storage, GameHost host, AudioManager audio) toolbar.AddAssembly(asm.GetName().Name, asm); Assembly.BindValueChanged(updateList); - RunAllSteps.BindValueChanged(v => runTests(null)); + RunAllSteps.BindValueChanged(_ => runTests(null)); PlaybackRate.BindValueChanged(e => { rateAdjustClock.Rate = e.NewValue; diff --git a/osu.Framework/Threading/ThreadedTaskScheduler.cs b/osu.Framework/Threading/ThreadedTaskScheduler.cs index f6cdc54e4a..3b454feb91 100644 --- a/osu.Framework/Threading/ThreadedTaskScheduler.cs +++ b/osu.Framework/Threading/ThreadedTaskScheduler.cs @@ -43,7 +43,7 @@ public ThreadedTaskScheduler(int numberOfThreads, string name) this.name = name; tasks = new BlockingCollection(); - threads = Enumerable.Range(0, numberOfThreads).Select(i => + threads = Enumerable.Range(0, numberOfThreads).Select(_ => { var thread = new Thread(processTasks) { From 8d89a54774c3ce17072ff2e8d9e72d64147faf83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:42:32 +0900 Subject: [PATCH 04/11] Remove unnecessary `null` casts --- osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs | 2 +- osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs | 2 +- osu.Framework/Input/StateChanges/TouchInput.cs | 2 +- osu.Framework/Input/States/TouchState.cs | 2 +- osu.Framework/Platform/MacOS/Native/NSPasteboard.cs | 2 +- osu.Framework/Text/TextBuilder.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs b/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs index b582a0d048..d1b1db7640 100644 --- a/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs +++ b/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs @@ -253,7 +253,7 @@ private void setCursorConfineRect(bool enabled) Width = host.Window.ClientSize.Width * 2 / 3f, Height = host.Window.ClientSize.Height * 2 / 3f, } - : (RectangleF?)null; + : null; } } } diff --git a/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs b/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs index d596eb1c89..b6311b55d0 100644 --- a/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs +++ b/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs @@ -91,7 +91,7 @@ public override void ApplyState() shrunkDrawRectangle = shrunkDrawRectangle.Shrink(new Vector2(Math.Min(shrunkDrawRectangle.Width / 2, shrinkage), Math.Min(shrunkDrawRectangle.Height / 2, shrinkage))); maskingInfo = !Source.Masking - ? (MaskingInfo?)null + ? null : new MaskingInfo { ScreenSpaceAABB = Source.ScreenSpaceDrawQuad.AABB, diff --git a/osu.Framework/Input/StateChanges/TouchInput.cs b/osu.Framework/Input/StateChanges/TouchInput.cs index c4163ce585..99ca1a9873 100644 --- a/osu.Framework/Input/StateChanges/TouchInput.cs +++ b/osu.Framework/Input/StateChanges/TouchInput.cs @@ -61,7 +61,7 @@ public void Apply(InputState state, IInputStateChangeHandler handler) if (activityChanged || positionChanged) { handler.HandleInputStateChange(new TouchStateChangeEvent(state, this, touch, - !activityChanged ? (bool?)null : Activate, + !activityChanged ? null : Activate, !positionChanged ? null : lastPosition )); } diff --git a/osu.Framework/Input/States/TouchState.cs b/osu.Framework/Input/States/TouchState.cs index 05263b0c63..6a53437d06 100644 --- a/osu.Framework/Input/States/TouchState.cs +++ b/osu.Framework/Input/States/TouchState.cs @@ -36,7 +36,7 @@ public class TouchState /// /// The touch source. /// The touch position, or null if provided is not currently active. - public Vector2? GetTouchPosition(TouchSource source) => IsActive(source) ? TouchPositions[(int)source] : (Vector2?)null; + public Vector2? GetTouchPosition(TouchSource source) => IsActive(source) ? TouchPositions[(int)source] : null; /// /// Whether the provided touch is active. diff --git a/osu.Framework/Platform/MacOS/Native/NSPasteboard.cs b/osu.Framework/Platform/MacOS/Native/NSPasteboard.cs index 0456b03fe0..c16c072758 100644 --- a/osu.Framework/Platform/MacOS/Native/NSPasteboard.cs +++ b/osu.Framework/Platform/MacOS/Native/NSPasteboard.cs @@ -33,7 +33,7 @@ internal bool CanReadObjectForClasses(NSArray classArray, NSDictionary? optionDi internal NSArray? ReadObjectsForClasses(NSArray classArray, NSDictionary? optionDict) { var result = Cocoa.SendIntPtr(Handle, sel_read_objects_for_classes, classArray.Handle, optionDict?.Handle ?? IntPtr.Zero); - return result == IntPtr.Zero ? (NSArray?)null : new NSArray(result); + return result == IntPtr.Zero ? null : new NSArray(result); } internal bool WriteObjects(NSArray objects) => Cocoa.SendBool(Handle, sel_write_objects, objects.Handle); diff --git a/osu.Framework/Text/TextBuilder.cs b/osu.Framework/Text/TextBuilder.cs index 9a88ee99be..322717458f 100644 --- a/osu.Framework/Text/TextBuilder.cs +++ b/osu.Framework/Text/TextBuilder.cs @@ -223,7 +223,7 @@ public void RemoveLastCharacter() return; TextBuilderGlyph removedCharacter = Characters[^1]; - TextBuilderGlyph? previousCharacter = Characters.Count == 1 ? null : (TextBuilderGlyph?)Characters[^2]; + TextBuilderGlyph? previousCharacter = Characters.Count == 1 ? null : Characters[^2]; Characters.RemoveAt(Characters.Count - 1); From 12b8e0406c8be7537360b9cb637e81e503322db1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:43:00 +0900 Subject: [PATCH 05/11] Remove redundant delegate instantiation --- .../Visual/UserInterface/TestSceneContextMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs index f490e40a8e..027b355f0e 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs @@ -283,7 +283,7 @@ private void clickOutsideStep() }); } - private void addBoxStep(Action boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat(new Action(() => { }), actionCount).ToArray()); + private void addBoxStep(Action boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat(() => { }, actionCount).ToArray()); private void addBoxStep(Action boxFunc, params Action[] actions) { From 1c49eaa0cc2ce2ca616b1035cb5c79880ba9a93a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:45:41 +0900 Subject: [PATCH 06/11] Update `out` parameters to have potential null returns --- osu.Framework/Bindables/BindableDictionary.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Framework/Bindables/BindableDictionary.cs b/osu.Framework/Bindables/BindableDictionary.cs index a6ea78d262..4d392987dd 100644 --- a/osu.Framework/Bindables/BindableDictionary.cs +++ b/osu.Framework/Bindables/BindableDictionary.cs @@ -136,7 +136,7 @@ private void setKey(TKey key, TValue value, BindableDictionary? ca { ensureMutationAllowed(); - bool hasPreviousValue = TryGetValue(key, out TValue lastValue); + bool hasPreviousValue = TryGetValue(key, out TValue? lastValue); collection[key] = value; @@ -232,7 +232,7 @@ bool IDictionary.Contains(object key) bool ICollection>.Remove(KeyValuePair item) { - if (TryGetValue(item.Key, out TValue value) && EqualityComparer.Default.Equals(value, item.Value)) + if (TryGetValue(item.Key, out TValue? value) && EqualityComparer.Default.Equals(value, item.Value)) { Remove(item.Key); return true; From 8868aa40872d02e4c42c101d18c2decd5f6a7637 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:53:19 +0900 Subject: [PATCH 07/11] Try 9 instead --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 82c34a6d7b..c683a4edf0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - 10.0 + 9.0 true enable From ac0e988e4241e34ec204e8dbbdf1323f2274ed96 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 14:53:48 +0900 Subject: [PATCH 08/11] Revert "Remove redundant delegate instantiation" This reverts commit 12b8e0406c8be7537360b9cb637e81e503322db1. --- .../Visual/UserInterface/TestSceneContextMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs index 027b355f0e..f490e40a8e 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs @@ -283,7 +283,7 @@ private void clickOutsideStep() }); } - private void addBoxStep(Action boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat(() => { }, actionCount).ToArray()); + private void addBoxStep(Action boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat(new Action(() => { }), actionCount).ToArray()); private void addBoxStep(Action boxFunc, params Action[] actions) { From edfc2eb6454174f48110a18a17ae4f0aa4c866c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 15:24:26 +0900 Subject: [PATCH 09/11] Update `new` code syntax rules to match our specifications --- osu-framework.sln.DotSettings | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu-framework.sln.DotSettings b/osu-framework.sln.DotSettings index af8804c371..70551f434e 100644 --- a/osu-framework.sln.DotSettings +++ b/osu-framework.sln.DotSettings @@ -8,11 +8,15 @@ ExplicitlyExcluded SOLUTION WARNING + WARNING + WARNING WARNING WARNING HINT HINT WARNING + WARNING + WARNING WARNING True WARNING @@ -261,6 +265,7 @@ Explicit ExpressionBody BlockBody + ExplicitlyTyped True NEXT_LINE True From 58b49a444c20b0468231c46d8643a057ac5621df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 15:30:09 +0900 Subject: [PATCH 10/11] Add silly thing to fix silly issue --- .../Visual/UserInterface/TestSceneContextMenu.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs index f490e40a8e..29e56058aa 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneContextMenu.cs @@ -283,7 +283,8 @@ private void clickOutsideStep() }); } - private void addBoxStep(Action boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat(new Action(() => { }), actionCount).ToArray()); + // ReSharper disable once RedundantTypeArgumentsOfMethod (can be removed with c# language version 10). + private void addBoxStep(Action boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat(() => { }, actionCount).ToArray()); private void addBoxStep(Action boxFunc, params Action[] actions) { From d567280051e985d7b74504f73ec37de8ef31e8b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jun 2022 15:56:26 +0900 Subject: [PATCH 11/11] Discard redundant throw away and switch remaining suggestions to hint or warning --- osu-framework.sln.DotSettings | 4 ++++ .../Visual/Input/TestSceneTouchInput.cs | 8 ++++---- osu.Framework/Audio/Track/TrackBass.cs | 6 +++--- osu.Framework/Bindables/Bindable.cs | 2 +- .../Graphics/Containers/Markdown/MarkdownContainer.cs | 4 ++-- .../Containers/Markdown/MarkdownTextFlowContainer.cs | 6 +++--- osu.Framework/Graphics/Containers/OverlayContainer.cs | 4 ++-- osu.Framework/Input/InputManager.cs | 6 +++--- osu.Framework/Input/PassThroughInputManager.cs | 10 +++++----- osu.Framework/Input/UserInputManager.cs | 2 +- 10 files changed, 28 insertions(+), 24 deletions(-) diff --git a/osu-framework.sln.DotSettings b/osu-framework.sln.DotSettings index 70551f434e..6c41a91352 100644 --- a/osu-framework.sln.DotSettings +++ b/osu-framework.sln.DotSettings @@ -124,6 +124,7 @@ WARNING WARNING WARNING + HINT WARNING WARNING WARNING @@ -137,6 +138,8 @@ HINT HINT WARNING + HINT + HINT WARNING HINT WARNING @@ -147,6 +150,7 @@ DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW + WARNING WARNING WARNING WARNING diff --git a/osu.Framework.Tests/Visual/Input/TestSceneTouchInput.cs b/osu.Framework.Tests/Visual/Input/TestSceneTouchInput.cs index 6253a20643..73db4192b9 100644 --- a/osu.Framework.Tests/Visual/Input/TestSceneTouchInput.cs +++ b/osu.Framework.Tests/Visual/Input/TestSceneTouchInput.cs @@ -465,10 +465,10 @@ protected override bool Handle(UIEvent e) break; - case MouseDownEvent _: - case MouseMoveEvent _: - case DragEvent _: - case MouseUpEvent _: + case MouseDownEvent: + case MouseMoveEvent: + case DragEvent: + case MouseUpEvent: if (HandleMouse?.Invoke((MouseEvent)e) != false) { MouseEvents.Enqueue((MouseEvent)e); diff --git a/osu.Framework/Audio/Track/TrackBass.cs b/osu.Framework/Audio/Track/TrackBass.cs index 86d4bf1def..5f1d63231b 100644 --- a/osu.Framework/Audio/Track/TrackBass.cs +++ b/osu.Framework/Audio/Track/TrackBass.cs @@ -133,9 +133,9 @@ private int prepareStream(Stream data, bool quick) { switch (data) { - case MemoryStream _: - case UnmanagedMemoryStream _: - case AsyncBufferStream _: + case MemoryStream: + case UnmanagedMemoryStream: + case AsyncBufferStream: // Buffering memory stream is definitely unworthy. dataStream = data; break; diff --git a/osu.Framework/Bindables/Bindable.cs b/osu.Framework/Bindables/Bindable.cs index 93d9df61b2..d621af5999 100644 --- a/osu.Framework/Bindables/Bindable.cs +++ b/osu.Framework/Bindables/Bindable.cs @@ -245,7 +245,7 @@ public virtual void Parse(object input) Value = t; break; - case IBindable _: + case IBindable: if (!(input is IBindable bindable)) throw new ArgumentException($"Expected bindable of type {nameof(IBindable)}<{typeof(T)}>, got {input.GetType()}", nameof(input)); diff --git a/osu.Framework/Graphics/Containers/Markdown/MarkdownContainer.cs b/osu.Framework/Graphics/Containers/Markdown/MarkdownContainer.cs index 301b9a9a28..e7bf478ce8 100644 --- a/osu.Framework/Graphics/Containers/Markdown/MarkdownContainer.cs +++ b/osu.Framework/Graphics/Containers/Markdown/MarkdownContainer.cs @@ -259,11 +259,11 @@ protected virtual void AddMarkdownComponent(IMarkdownObject markdownObject, Fill AddMarkdownComponent(single, container, level); break; - case HtmlBlock _: + case HtmlBlock: // HTML is not supported break; - case LinkReferenceDefinitionGroup _: + case LinkReferenceDefinitionGroup: // Link reference doesn't need to be displayed. break; diff --git a/osu.Framework/Graphics/Containers/Markdown/MarkdownTextFlowContainer.cs b/osu.Framework/Graphics/Containers/Markdown/MarkdownTextFlowContainer.cs index 5284f9fbfd..aac91de8c1 100644 --- a/osu.Framework/Graphics/Containers/Markdown/MarkdownTextFlowContainer.cs +++ b/osu.Framework/Graphics/Containers/Markdown/MarkdownTextFlowContainer.cs @@ -56,7 +56,7 @@ public void AddInlineText(ContainerInline container) { switch (literal.Parent) { - case EmphasisInline _: + case EmphasisInline: var parent = literal.Parent; var emphases = new List(); @@ -94,8 +94,8 @@ public void AddInlineText(ContainerInline container) AddImage(linkInline); break; - case HtmlInline _: - case HtmlEntityInline _: + case HtmlInline: + case HtmlEntityInline: // Handled by the next literal break; diff --git a/osu.Framework/Graphics/Containers/OverlayContainer.cs b/osu.Framework/Graphics/Containers/OverlayContainer.cs index 1365dee5ef..aa6cd2d1f1 100644 --- a/osu.Framework/Graphics/Containers/OverlayContainer.cs +++ b/osu.Framework/Graphics/Containers/OverlayContainer.cs @@ -49,13 +49,13 @@ protected override bool Handle(UIEvent e) { switch (e) { - case ScrollEvent _: + case ScrollEvent: if (BlockScrollInput && base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition)) return true; break; - case MouseEvent _: + case MouseEvent: if (BlockPositionalInput) return true; diff --git a/osu.Framework/Input/InputManager.cs b/osu.Framework/Input/InputManager.cs index 1e8cd35a48..8b5974bd12 100644 --- a/osu.Framework/Input/InputManager.cs +++ b/osu.Framework/Input/InputManager.cs @@ -890,9 +890,9 @@ private bool shouldLog(UIEvent eventType) case KeyDownEvent k: return !k.Repeat; - case DragEvent _: - case ScrollEvent _: - case MouseMoveEvent _: + case DragEvent: + case ScrollEvent: + case MouseMoveEvent: return false; default: diff --git a/osu.Framework/Input/PassThroughInputManager.cs b/osu.Framework/Input/PassThroughInputManager.cs index a8997907d8..37bdb6ed68 100644 --- a/osu.Framework/Input/PassThroughInputManager.cs +++ b/osu.Framework/Input/PassThroughInputManager.cs @@ -120,11 +120,11 @@ protected override bool Handle(UIEvent e) new MidiKeyInput(midi.Key, midi.Velocity, midi.IsPressed(midi.Key)).Apply(CurrentState, this); break; - case KeyboardEvent _: - case JoystickButtonEvent _: - case JoystickAxisMoveEvent _: - case TabletPenButtonEvent _: - case TabletAuxiliaryButtonEvent _: + case KeyboardEvent: + case JoystickButtonEvent: + case JoystickAxisMoveEvent: + case TabletPenButtonEvent: + case TabletAuxiliaryButtonEvent: SyncInputState(e.CurrentState); break; } diff --git a/osu.Framework/Input/UserInputManager.cs b/osu.Framework/Input/UserInputManager.cs index 2eece5c04b..854ef21f6d 100644 --- a/osu.Framework/Input/UserInputManager.cs +++ b/osu.Framework/Input/UserInputManager.cs @@ -73,7 +73,7 @@ public override void HandleInputStateChange(InputStateChangeEvent inputStateChan break; - case MouseScrollChangeEvent _: + case MouseScrollChangeEvent: if (Host.Window?.CursorInWindow.Value == false) return;