Skip to content

Commit 997cc59

Browse files
committed
Enable CA1851 and fix noncompliance
"Possible multiple enumerations of `IEnumerable` collection"
1 parent d762501 commit 997cc59

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.global.editorconfig.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ dotnet_diagnostic.CA1829.severity = error
122122
dotnet_diagnostic.CA1836.severity = error
123123
# Avoid StringBuilder parameters for P/Invokes
124124
dotnet_diagnostic.CA1838.severity = suggestion
125+
# Possible multiple enumerations of `IEnumerable` collection
126+
dotnet_diagnostic.CA1851.severity = warning
125127
# Prefer the `IDictionary.TryGetValue(TKey, out TValue)` method
126128
dotnet_diagnostic.CA1854.severity = warning
127129
# Avoid using 'Enumerable.Any()' extension method

src/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ public void InsertInput(int frame, string inputState)
154154

155155
public void InsertInput(int frame, IEnumerable<string> inputLog)
156156
{
157-
Log.InsertRange(frame, inputLog);
158-
ShiftBindedMarkers(frame, inputLog.Count());
159-
ChangeLog.AddInsertInput(frame, inputLog.ToList(), BindMarkersToInput, $"Insert {inputLog.Count()} frame(s) at {frame}");
160-
157+
var inputLogCopy = inputLog.ToList();
158+
Log.InsertRange(frame, inputLogCopy);
159+
ShiftBindedMarkers(frame, inputLogCopy.Count);
160+
ChangeLog.AddInsertInput(frame, inputLogCopy, BindMarkersToInput, $"Insert {inputLogCopy.Count} frame(s) at {frame}");
161161
InvalidateAfter(frame);
162162
}
163163

src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Disk/IPFFormat/IPFFloppyDisk.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public override bool ParseDisk(byte[] data)
6565
// now process the blocks
6666
var infoBlock = blocks.Find(static a => a.RecordType == RecordHeaderType.INFO);
6767
var IMGEblocks = blocks.Where(a => a.RecordType == RecordHeaderType.IMGE).ToList();
68-
var DATAblocks = blocks.Where(a => a.RecordType == RecordHeaderType.DATA);
68+
var DATAblocks = blocks.Where(static block => block.RecordType is RecordHeaderType.DATA).ToArray();
6969

7070
DiskHeader.NumberOfTracks = (byte)(IMGEblocks.Count);
7171
DiskHeader.NumberOfSides = (byte)(infoBlock.INFOmaxSide + 1);

0 commit comments

Comments
 (0)