Skip to content

Commit 14a3f64

Browse files
committed
Re-enable IDE0031 and adopt ?=
1 parent c906b51 commit 14a3f64

File tree

24 files changed

+29
-91
lines changed

24 files changed

+29
-91
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dotnet_diagnostic.IDE0029.severity = warning
5858
# Null check can be simplified
5959
dotnet_diagnostic.IDE0030.severity = warning
6060
# Use null propagation
61-
dotnet_diagnostic.IDE0031.severity = suggestion
61+
dotnet_diagnostic.IDE0031.severity = warning
6262
# Use auto property
6363
dotnet_diagnostic.IDE0032.severity = suggestion
6464
# Simplify default expression

src/BizHawk.Client.EmuHawk/MainForm.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3688,13 +3688,11 @@ private bool LoadRomInternal(string path, LoadRomArgs args, out bool failureIsFr
36883688
{
36893689
oaRetro.token.Path = loader.CanonicalFullPath;
36903690
}
3691-
3692-
if (oaOpenrom != null)
3691+
else if (oaOpenrom is not null)
36933692
{
36943693
oaOpenrom.Path = loader.CanonicalFullPath;
36953694
}
3696-
3697-
if (ioa is OpenAdvanced_MAME oaMame)
3695+
else if (ioa is OpenAdvanced_MAME oaMame)
36983696
{
36993697
oaMame.Path = loader.CanonicalFullPath;
37003698
}

src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,7 @@ public void SetBranchText(string text, int? index = null)
425425
if (index != null)
426426
{
427427
var branch = Tastudio.CurrentTasMovie.Branches[index.Value];
428-
if (branch != null)
429-
{
430-
branch.UserText = text1;
431-
}
428+
branch?.UserText = text1;
432429
}
433430
else
434431
{

src/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,7 @@ private void paletteViewer_MouseClick(object sender, MouseEventArgs e)
816816
bool valid = TranslatePaletteCoord(e.Location, out var pt);
817817
if (!valid) return;
818818
selectedColorNum = pt.Y * 16 + pt.X;
819-
820-
if (currTileDataState != null)
821-
{
822-
currTileDataState.Palette = currPaletteSelection.start;
823-
}
824-
819+
currTileDataState?.Palette = currPaletteSelection.start;
825820
SyncColorSelection();
826821
InternalUpdateValues();
827822
}

src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ public partial class BookmarksBranchesBox : UserControl, IDialogParent
2727
private BranchUndo _branchUndo = BranchUndo.None;
2828

2929
public void SetBackupMaxSteps(int value)
30-
{
31-
if (_backupBranch != null) _backupBranch.ChangeLog.MaxSteps = value;
32-
}
30+
=> _backupBranch?.ChangeLog.MaxSteps = value;
3331

3432
private enum BranchUndo
3533
{
@@ -353,11 +351,7 @@ private void UndoBranchToolStripMenuItem_Click(object sender, EventArgs e)
353351
else if (_branchUndo == BranchUndo.Text)
354352
{
355353
var branch = Branches.SingleOrDefault(b => b.Uuid == _backupBranch.Uuid);
356-
if (branch != null)
357-
{
358-
branch.UserText = _backupBranch.UserText;
359-
}
360-
354+
branch?.UserText = _backupBranch.UserText;
361355
Tastudio.MainForm.AddOnScreenMessage("Branch Text Edit canceled");
362356
}
363357
else if (_branchUndo == BranchUndo.Remove)

src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,8 @@ public Motherboard(C64 c64, C64.VicType initRegion, C64.BorderType borderType, C
147147
CharRom = new Chip23128();
148148
KernalRom = new Chip23128();
149149

150-
if (Cpu != null)
151-
Cpu.DebuggerStep = Execute;
152-
if (DiskDrive != null)
153-
DiskDrive.DebuggerStep = Execute;
150+
Cpu?.DebuggerStep = Execute;
151+
DiskDrive?.DebuggerStep = Execute;
154152
}
155153

156154
public int ClockNumerator { get; }

src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,8 @@ public ZXSpectrum(
135135
ay38912.PanningConfiguration = settings.AYPanConfig;
136136
ay38912.Volume = settings.AYVolume;
137137
}
138-
139-
if (_machine.BuzzerDevice != null)
140-
{
141-
_machine.BuzzerDevice.Volume = settings.EarVolume;
142-
}
143-
144-
if (_machine.TapeBuzzer != null)
145-
{
146-
_machine.TapeBuzzer.Volume = settings.TapeVolume;
147-
}
138+
_machine.BuzzerDevice?.Volume = settings.EarVolume;
139+
_machine.TapeBuzzer?.Volume = settings.TapeVolume;
148140

149141
DCFilter dc = new DCFilter(SoundMixer, 512);
150142
ser.Register<ISoundProvider>(dc);

src/BizHawk.Emulation.Cores/Consoles/Nintendo/BSNES/SNESGraphicsDecoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public void RenderSpriteToScreen(
386386
screen[dofs] = color;
387387
Paletteize(screen, dofs, oamInfo.Palette * 16 + 128, 1);
388388
Colorize(screen, dofs, 1);
389-
if (spriteMap != null) spriteMap[dx, dy] = (byte)spritenum;
389+
spriteMap?[dx, dy] = (byte) spritenum;
390390
}
391391
}
392392
}

src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Default.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public override void WriteMemory(ushort addr, byte value)
6666
}
6767
else
6868
{
69-
if (Core.cart_RAM != null)
70-
{
71-
Core.cart_RAM[addr - 0xA000] = value;
72-
}
69+
Core.cart_RAM?[addr - 0xA000] = value;
7370
}
7471
}
7572

src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC6.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ public override void WriteMemory(ushort addr, byte value)
7373
}
7474
else
7575
{
76-
if (Core.cart_RAM != null)
77-
{
78-
Core.cart_RAM[addr - 0xA000] = value;
79-
}
76+
Core.cart_RAM?[addr - 0xA000] = value;
8077
}
8178
}
8279

0 commit comments

Comments
 (0)