Skip to content

Commit 8ce43e8

Browse files
authored
[src] Enable stylecop's SA1132 (do not combine fields) warning. (#22299)
Also fix any resulting warnings.
1 parent fd1f296 commit 8ce43e8

File tree

8 files changed

+28
-11
lines changed

8 files changed

+28
-11
lines changed

src/AVFoundation/Events.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public AVStatusEventArgs (bool status)
7474

7575
#pragma warning disable 672
7676
sealed class InternalAVAudioPlayerDelegate : AVAudioPlayerDelegate {
77-
internal EventHandler? cbEndInterruption, cbBeginInterruption;
77+
internal EventHandler? cbEndInterruption;
78+
internal EventHandler? cbBeginInterruption;
7879
internal EventHandler<AVStatusEventArgs>? cbFinishedPlaying;
7980
internal EventHandler<AVErrorEventArgs?>? cbDecoderError;
8081

@@ -174,7 +175,8 @@ public event EventHandler EndInterruption {
174175

175176
#if !TVOS
176177
internal class InternalAVAudioRecorderDelegate : AVAudioRecorderDelegate {
177-
internal EventHandler? cbEndInterruption, cbBeginInterruption;
178+
internal EventHandler? cbEndInterruption;
179+
internal EventHandler? cbBeginInterruption;
178180
internal EventHandler<AVStatusEventArgs>? cbFinishedRecording;
179181
internal EventHandler<AVErrorEventArgs?>? cbEncoderError;
180182

@@ -315,7 +317,8 @@ public AVCategoryEventArgs (string category)
315317

316318
#if !MONOMAC && !TVOS
317319
internal class InternalAVAudioSessionDelegate : AVAudioSessionDelegate {
318-
internal EventHandler? cbEndInterruption, cbBeginInterruption;
320+
internal EventHandler? cbEndInterruption;
321+
internal EventHandler? cbBeginInterruption;
319322
internal EventHandler<AVCategoryEventArgs>? cbCategoryChanged;
320323
internal EventHandler<AVStatusEventArgs>? cbInputAvailabilityChanged;
321324
internal EventHandler<AVSampleRateEventArgs>? cbSampleRateChanged;

src/AudioToolbox/AudioType.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,9 @@ public struct AudioChannelDescription {
816816
/// <summary>Determines how the coordinates should be interpreted.</summary>
817817
/// <remarks>To be added.</remarks>
818818
public AudioChannelFlags Flags;
819-
float Coord0, Coord1, Coord2;
819+
float Coord0;
820+
float Coord1;
821+
float Coord2;
820822
#if !COREBUILD
821823

822824
/// <summary>To be added.</summary>

src/AudioUnit/AudioUnit.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,9 @@ public AURenderEvent? Next {
14641464
/// <remarks>To be added.</remarks>
14651465
public AURenderEventType EventType;
14661466

1467-
internal byte reserved1, reserved2, reserved3;
1467+
internal byte reserved1;
1468+
internal byte reserved2;
1469+
internal byte reserved3;
14681470

14691471
/// <summary>To be added.</summary>
14701472
/// <remarks>To be added.</remarks>

src/CoreFoundation/CFStream.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ public abstract class CFStream : CFType {
177177
GCHandle gch;
178178
CFRunLoop? loop;
179179
NSString? loopMode;
180-
bool open, closed;
180+
bool open;
181+
bool closed;
181182

182183
#region Stream Constructors
183184

src/GameKit/GameKit2.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public event EventHandler<GKPeerConnectionEventArgs> Failed {
140140

141141
class Mono_GKSessionDelegate : GKSessionDelegate {
142142
internal EventHandler<GKPeerChangedStateEventArgs>? cbPeerChanged;
143-
internal EventHandler<GKPeerConnectionEventArgs>? cbConnectionRequest, cbConnectionFailed, cbFailedWithError;
143+
internal EventHandler<GKPeerConnectionEventArgs>? cbConnectionRequest;
144+
internal EventHandler<GKPeerConnectionEventArgs>? cbConnectionFailed;
145+
internal EventHandler<GKPeerConnectionEventArgs>? cbFailedWithError;
144146

145147
public Mono_GKSessionDelegate ()
146148
{

src/Metal/Defs.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,10 @@ public MTLIndirectCommandBufferExecutionRange (uint location, uint length)
666666
public struct MTLTextureSwizzleChannels {
667667
#if COREBUILD
668668
// keep size identical
669-
byte Red, Green, Blue, Alpha;
669+
byte Red;
670+
byte Green;
671+
byte Blue;
672+
byte Alpha;
670673
#else
671674
public MTLTextureSwizzle Red;
672675

src/PrintCore/Defs.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ public enum PMOrientation : System.UInt16 {
168168
#endif
169169
[StructLayout (LayoutKind.Sequential)]
170170
public struct PMResolution {
171-
double hRes, vRes;
171+
double hRes;
172+
double vRes;
172173
public double HorizontalResolution => hRes;
173174
public double VerticalResolution => vRes;
174175

@@ -188,7 +189,10 @@ public override string ToString ()
188189
#endif
189190
[StructLayout (LayoutKind.Sequential)]
190191
public struct PMRect {
191-
internal double top, left, bottom, right;
192+
internal double top;
193+
internal double left;
194+
internal double bottom;
195+
internal double right;
192196

193197
public double Top => top;
194198
public double Left => left;

src/stylecop.ruleset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<Rule Id="SA1129" Action="None" /> <!-- Do not use default value type constructor -->
7070
<Rule Id="SA1130" Action="None" /> <!-- Use lambda syntax -->
7171
<Rule Id="SA1131" Action="None" /> <!-- Use readable conditions -->
72-
<Rule Id="SA1132" Action="None" /> <!-- Do not combine fields -->
72+
<Rule Id="SA1132" Action="Warning" /> <!-- Do not combine fields -->
7373
<Rule Id="SA1133" Action="None" /> <!-- Do not combine attributes -->
7474
<Rule Id="SA1134" Action="None" /> <!-- Attributes should not share line -->
7575
<Rule Id="SA1135" Action="None" /> <!-- Using directives should be qualified -->

0 commit comments

Comments
 (0)