Merge pull request #16734 from bdach/war-on-unused-params

Fix several cases of unused constructor and method parameters
This commit is contained in:
Dean Herbert 2022-02-02 07:40:58 +09:00 committed by GitHub
commit 6033c89e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 35 additions and 44 deletions

View File

@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
case CatchSkinComponents.CatchComboCounter: case CatchSkinComponents.CatchComboCounter:
if (providesComboCounter) if (providesComboCounter)
return new LegacyCatchComboCounter(Skin); return new LegacyCatchComboCounter();
return null; return null;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
private readonly LegacyRollingCounter explosion; private readonly LegacyRollingCounter explosion;
public LegacyCatchComboCounter(ISkin skin) public LegacyCatchComboCounter()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
Child = new ColumnHitObjectArea(0, new HitObjectContainer()) Child = new ColumnHitObjectArea(new HitObjectContainer())
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} }
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
Child = new ColumnHitObjectArea(1, new HitObjectContainer()) Child = new ColumnHitObjectArea(new HitObjectContainer())
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} }

View File

@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.UI
sampleTriggerSource = new GameplaySampleTriggerSource(HitObjectContainer), sampleTriggerSource = new GameplaySampleTriggerSource(HitObjectContainer),
// For input purposes, the background is added at the highest depth, but is then proxied back below all other elements // For input purposes, the background is added at the highest depth, but is then proxied back below all other elements
background.CreateProxy(), background.CreateProxy(),
HitObjectArea = new ColumnHitObjectArea(Index, HitObjectContainer) { RelativeSizeAxes = Axes.Both }, HitObjectArea = new ColumnHitObjectArea(HitObjectContainer) { RelativeSizeAxes = Axes.Both },
new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea()) new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea())
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
private readonly Drawable hitTarget; private readonly Drawable hitTarget;
public ColumnHitObjectArea(int columnIndex, HitObjectContainer hitObjectContainer) public ColumnHitObjectArea(HitObjectContainer hitObjectContainer)
: base(hitObjectContainer) : base(hitObjectContainer)
{ {
AddRangeInternal(new[] AddRangeInternal(new[]

View File

@ -118,7 +118,6 @@ namespace osu.Game.Rulesets.Osu.Tests
public Drawable GetDrawableComponent(ISkinComponent component) => null; public Drawable GetDrawableComponent(ISkinComponent component) => null;
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null; public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => null;
public ISample GetSample(ISampleInfo sampleInfo) => null; public ISample GetSample(ISampleInfo sampleInfo) => null;
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{ {

View File

@ -52,7 +52,7 @@ namespace osu.Game.Tests.Editing.Checks
beatmap.BeatmapInfo.BeatmapSet.Files.Add(CheckTestHelpers.CreateMockFile("jpg")); beatmap.BeatmapInfo.BeatmapSet.Files.Add(CheckTestHelpers.CreateMockFile("jpg"));
// Should fail to load, but not produce an error due to the extension not being expected to load. // Should fail to load, but not produce an error due to the extension not being expected to load.
Assert.IsEmpty(check.Run(getContext(null, allowMissing: true))); Assert.IsEmpty(check.Run(getContext(null)));
} }
[Test] [Test]
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Editing.Checks
{ {
using (var resourceStream = TestResources.OpenResource("Samples/missing.mp3")) using (var resourceStream = TestResources.OpenResource("Samples/missing.mp3"))
{ {
Assert.IsEmpty(check.Run(getContext(resourceStream, allowMissing: true))); Assert.IsEmpty(check.Run(getContext(resourceStream)));
} }
} }
@ -107,7 +107,7 @@ namespace osu.Game.Tests.Editing.Checks
} }
} }
private BeatmapVerifierContext getContext(Stream resourceStream, bool allowMissing = false) private BeatmapVerifierContext getContext(Stream resourceStream)
{ {
var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null); var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null);
mockWorkingBeatmap.Setup(w => w.GetStream(It.IsAny<string>())).Returns(resourceStream); mockWorkingBeatmap.Setup(w => w.GetStream(It.IsAny<string>())).Returns(resourceStream);

View File

@ -131,8 +131,6 @@ namespace osu.Game.Tests.Gameplay
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException(); public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{ {
switch (lookup) switch (lookup)

View File

@ -61,7 +61,6 @@ namespace osu.Game.Tests.NonVisual.Skinning
public Drawable GetDrawableComponent(ISkinComponent component) => throw new NotSupportedException(); public Drawable GetDrawableComponent(ISkinComponent component) => throw new NotSupportedException();
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException(); public ISample GetSample(ISampleInfo sampleInfo) => throw new NotSupportedException();
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotSupportedException(); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotSupportedException();
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => null;
} }
private class TestAnimationTimeReference : IAnimationTimeReference private class TestAnimationTimeReference : IAnimationTimeReference

View File

@ -47,7 +47,7 @@ namespace osu.Game.Tests.Online
{ {
Dependencies.Cache(rulesets = new RulesetStore(Realm)); Dependencies.Cache(rulesets = new RulesetStore(Realm));
Dependencies.CacheAs<BeatmapManager>(beatmaps = new TestBeatmapManager(LocalStorage, Realm, rulesets, API, audio, Resources, host, Beatmap.Default)); Dependencies.CacheAs<BeatmapManager>(beatmaps = new TestBeatmapManager(LocalStorage, Realm, rulesets, API, audio, Resources, host, Beatmap.Default));
Dependencies.CacheAs<BeatmapModelDownloader>(beatmapDownloader = new TestBeatmapModelDownloader(beatmaps, API, host)); Dependencies.CacheAs<BeatmapModelDownloader>(beatmapDownloader = new TestBeatmapModelDownloader(beatmaps, API));
} }
[SetUp] [SetUp]
@ -173,14 +173,14 @@ namespace osu.Game.Tests.Online
protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue)
{ {
return new TestBeatmapModelManager(this, storage, realm, rulesets, onlineLookupQueue); return new TestBeatmapModelManager(this, storage, realm, onlineLookupQueue);
} }
internal class TestBeatmapModelManager : BeatmapModelManager internal class TestBeatmapModelManager : BeatmapModelManager
{ {
private readonly TestBeatmapManager testBeatmapManager; private readonly TestBeatmapManager testBeatmapManager;
public TestBeatmapModelManager(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, RulesetStore rulesetStore, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue) public TestBeatmapModelManager(TestBeatmapManager testBeatmapManager, Storage storage, RealmAccess databaseAccess, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue)
: base(databaseAccess, storage, beatmapOnlineLookupQueue) : base(databaseAccess, storage, beatmapOnlineLookupQueue)
{ {
this.testBeatmapManager = testBeatmapManager; this.testBeatmapManager = testBeatmapManager;
@ -196,7 +196,7 @@ namespace osu.Game.Tests.Online
internal class TestBeatmapModelDownloader : BeatmapModelDownloader internal class TestBeatmapModelDownloader : BeatmapModelDownloader
{ {
public TestBeatmapModelDownloader(IModelImporter<BeatmapSetInfo> importer, IAPIProvider apiProvider, GameHost gameHost) public TestBeatmapModelDownloader(IModelImporter<BeatmapSetInfo> importer, IAPIProvider apiProvider)
: base(importer, apiProvider) : base(importer, apiProvider)
{ {
} }

View File

@ -301,8 +301,6 @@ namespace osu.Game.Tests.Visual.Gameplay
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException(); public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException(); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => throw new NotImplementedException();
} }
private class SecondarySource : ISkin private class SecondarySource : ISkin
@ -314,8 +312,6 @@ namespace osu.Game.Tests.Visual.Gameplay
public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException(); public ISample GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException(); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => throw new NotImplementedException();
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => throw new NotImplementedException();
} }
[Cached(typeof(ISkinSource))] [Cached(typeof(ISkinSource))]

View File

@ -46,7 +46,7 @@ namespace osu.Game.Beatmaps
public BeatmapMetadata(RealmUser? user = null) public BeatmapMetadata(RealmUser? user = null)
{ {
Author = new RealmUser(); Author = user ?? new RealmUser();
} }
[UsedImplicitly] // Realm [UsedImplicitly] // Realm

View File

@ -63,7 +63,7 @@ namespace osu.Game.Database
return; return;
} }
perform(retrieveFromID(r, ID)); perform(retrieveFromID(r));
RealmLiveStatistics.USAGE_ASYNC.Value++; RealmLiveStatistics.USAGE_ASYNC.Value++;
}); });
} }
@ -85,7 +85,7 @@ namespace osu.Game.Database
return realm.Run(r => return realm.Run(r =>
{ {
var returnData = perform(retrieveFromID(r, ID)); var returnData = perform(retrieveFromID(r));
RealmLiveStatistics.USAGE_ASYNC.Value++; RealmLiveStatistics.USAGE_ASYNC.Value++;
if (returnData is RealmObjectBase realmObject && realmObject.IsManaged) if (returnData is RealmObjectBase realmObject && realmObject.IsManaged)
@ -139,11 +139,11 @@ namespace osu.Game.Database
} }
dataIsFromUpdateThread = true; dataIsFromUpdateThread = true;
data = retrieveFromID(realm.Realm, ID); data = retrieveFromID(realm.Realm);
RealmLiveStatistics.USAGE_UPDATE_REFETCH.Value++; RealmLiveStatistics.USAGE_UPDATE_REFETCH.Value++;
} }
private T retrieveFromID(Realm realm, Guid id) private T retrieveFromID(Realm realm)
{ {
var found = realm.Find<T>(ID); var found = realm.Find<T>(ID);

View File

@ -247,7 +247,7 @@ namespace osu.Game
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, Host, () => difficultyCache, LocalConfig)); dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, Scheduler, () => difficultyCache, LocalConfig));
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true)); dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true));
dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API)); dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API));

View File

@ -32,7 +32,7 @@ namespace osu.Game.Scoring
private readonly ScoreModelManager scoreModelManager; private readonly ScoreModelManager scoreModelManager;
public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler, public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler,
IIpcHost importHost = null, Func<BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null) Func<BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null)
{ {
this.realm = realm; this.realm = realm;
this.scheduler = scheduler; this.scheduler = scheduler;

View File

@ -51,7 +51,7 @@ namespace osu.Game.Screens.Edit.Timing
} }
Columns = createHeaders(); Columns = createHeaders();
Content = value.Select((g, i) => createContent(i, g)).ToArray().ToRectangular(); Content = value.Select(createContent).ToArray().ToRectangular();
} }
} }
@ -76,7 +76,7 @@ namespace osu.Game.Screens.Edit.Timing
return columns.ToArray(); return columns.ToArray();
} }
private Drawable[] createContent(int index, ControlPointGroup group) private Drawable[] createContent(ControlPointGroup group)
{ {
return new Drawable[] return new Drawable[]
{ {

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osuTK; using osuTK;
@ -49,7 +48,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load()
{ {
InternalChild = new FillFlowContainer InternalChild = new FillFlowContainer
{ {
@ -127,7 +126,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
} }
}; };
createColourBars(colours); createColourBars();
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -150,7 +149,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
iconLate.Rotation = -Rotation; iconLate.Rotation = -Rotation;
} }
private void createColourBars(OsuColour colours) private void createColourBars()
{ {
var windows = HitWindows.GetAllAvailableWindows().ToArray(); var windows = HitWindows.GetAllAvailableWindows().ToArray();

View File

@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play.HUD
return; return;
if (isRolling) if (isRolling)
onDisplayedCountRolling(displayedCount, value); onDisplayedCountRolling(value);
else if (displayedCount + 1 == value) else if (displayedCount + 1 == value)
onDisplayedCountIncrement(value); onDisplayedCountIncrement(value);
else else
@ -151,7 +151,7 @@ namespace osu.Game.Screens.Play.HUD
if (prev + 1 == Current.Value) if (prev + 1 == Current.Value)
onCountIncrement(prev, Current.Value); onCountIncrement(prev, Current.Value);
else else
onCountChange(prev, Current.Value); onCountChange(Current.Value);
} }
else else
{ {
@ -226,7 +226,7 @@ namespace osu.Game.Screens.Play.HUD
transformRoll(currentValue, newValue); transformRoll(currentValue, newValue);
} }
private void onCountChange(int currentValue, int newValue) private void onCountChange(int newValue)
{ {
scheduledPopOutCurrentId++; scheduledPopOutCurrentId++;
@ -236,7 +236,7 @@ namespace osu.Game.Screens.Play.HUD
DisplayedCount = newValue; DisplayedCount = newValue;
} }
private void onDisplayedCountRolling(int currentValue, int newValue) private void onDisplayedCountRolling(int newValue)
{ {
if (newValue == 0) if (newValue == 0)
displayedCountSpriteText.FadeOut(fade_out_duration); displayedCountSpriteText.FadeOut(fade_out_duration);

View File

@ -251,7 +251,7 @@ namespace osu.Game.Screens.Play
{ {
// underlay and gameplay should have access to the skinning sources. // underlay and gameplay should have access to the skinning sources.
createUnderlayComponents(), createUnderlayComponents(),
createGameplayComponents(Beatmap.Value, playableBeatmap) createGameplayComponents(Beatmap.Value)
} }
}, },
FailOverlay = new FailOverlay FailOverlay = new FailOverlay
@ -364,7 +364,7 @@ namespace osu.Game.Screens.Play
private Drawable createUnderlayComponents() => private Drawable createUnderlayComponents() =>
DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both }; DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both };
private Drawable createGameplayComponents(IWorkingBeatmap working, IBeatmap playableBeatmap) => new ScalingContainer(ScalingMode.Gameplay) private Drawable createGameplayComponents(IWorkingBeatmap working) => new ScalingContainer(ScalingMode.Gameplay)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -77,7 +77,7 @@ namespace osu.Game.Skinning
userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files")); userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files"));
skinModelManager = new SkinModelManager(storage, realm, host, this); skinModelManager = new SkinModelManager(storage, realm, this);
var defaultSkins = new[] var defaultSkins = new[]
{ {

View File

@ -27,7 +27,7 @@ namespace osu.Game.Skinning
private readonly IStorageResourceProvider skinResources; private readonly IStorageResourceProvider skinResources;
public SkinModelManager(Storage storage, RealmAccess realm, GameHost host, IStorageResourceProvider skinResources) public SkinModelManager(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources)
: base(storage, realm) : base(storage, realm)
{ {
this.skinResources = skinResources; this.skinResources = skinResources;

View File

@ -126,7 +126,7 @@ namespace osu.Game.Tests.Visual
protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue) protected override BeatmapModelManager CreateBeatmapModelManager(Storage storage, RealmAccess realm, RulesetStore rulesets, BeatmapOnlineLookupQueue onlineLookupQueue)
{ {
return new TestBeatmapModelManager(storage, realm, rulesets, onlineLookupQueue); return new TestBeatmapModelManager(storage, realm, onlineLookupQueue);
} }
protected override WorkingBeatmapCache CreateWorkingBeatmapCache(AudioManager audioManager, IResourceStore<byte[]> resources, IResourceStore<byte[]> storage, WorkingBeatmap defaultBeatmap, GameHost host) protected override WorkingBeatmapCache CreateWorkingBeatmapCache(AudioManager audioManager, IResourceStore<byte[]> resources, IResourceStore<byte[]> storage, WorkingBeatmap defaultBeatmap, GameHost host)
@ -150,7 +150,7 @@ namespace osu.Game.Tests.Visual
internal class TestBeatmapModelManager : BeatmapModelManager internal class TestBeatmapModelManager : BeatmapModelManager
{ {
public TestBeatmapModelManager(Storage storage, RealmAccess databaseAccess, RulesetStore rulesetStore, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue) public TestBeatmapModelManager(Storage storage, RealmAccess databaseAccess, BeatmapOnlineLookupQueue beatmapOnlineLookupQueue)
: base(databaseAccess, storage, beatmapOnlineLookupQueue) : base(databaseAccess, storage, beatmapOnlineLookupQueue)
{ {
} }