Skip to content

Commit e4cfdfa

Browse files
committed
Code cleanup.
1 parent ef46fce commit e4cfdfa

23 files changed

+1
-63
lines changed

src/MsgPack/Binary.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ private static char ToHexChar( int b )
7171
{
7272
return unchecked( ( char )( '0' + b ) );
7373
}
74-
// ReSharper disable once RedundantIfElseBlock
7574
else
7675
{
7776
return unchecked( ( char )( 'A' + ( b - 10 ) ) );

src/MsgPack/ItemsUnpacker.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ protected override bool ReadCore()
110110
this.InternalData = value;
111111
return true;
112112
}
113-
// ReSharper disable once RedundantIfElseBlock
114113
else
115114
{
116115
return false;

src/MsgPack/MessagePackCode.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public static string ToString( int code )
6969
{
7070
return "PositiveFixNum";
7171
}
72-
// ReSharper disable once RedundantIfElseBlock
7372
else if( code >= 0xE0)
7473
{
7574
return "NegativeFixNum";

src/MsgPack/MessagePackObject.Utilities.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ internal MessagePackObject( MessagePackString messagePackString )
210210
public override bool Equals( Object obj )
211211
{
212212
MessagePackObjectDictionary asDictionary;
213-
// ReSharper disable RedundantIfElseBlock
214213
if ( ReferenceEquals( obj, null ) )
215214
{
216215
return this.IsNil;
@@ -227,7 +226,6 @@ public override bool Equals( Object obj )
227226
{
228227
return this.Equals( ( MessagePackObject )obj );
229228
}
230-
// ReSharper restore RedundantIfElseBlock
231229
}
232230

233231
/// <summary>
@@ -239,7 +237,6 @@ public override bool Equals( Object obj )
239237
/// </returns>
240238
public bool Equals( MessagePackObject other )
241239
{
242-
// ReSharper disable RedundantIfElseBlock
243240
if ( this._handleOrTypeCode == null )
244241
{
245242
return other._handleOrTypeCode == null;
@@ -315,7 +312,6 @@ public bool Equals( MessagePackObject other )
315312
return true;
316313
}
317314
}
318-
// ReSharper restore RedundantIfElseBlock
319315

320316
{
321317
var asExtendedTypeObjectBody = this._handleOrTypeCode as byte[];
@@ -411,7 +407,6 @@ private bool EqualsWhenValueType(
411407

412408
private static bool IntegerIntegerEquals( ulong left, ValueTypeCode leftTypeCode, ulong right, ValueTypeCode rightTypeCode )
413409
{
414-
// ReSharper disable RedundantIfElseBlock
415410
if ( leftTypeCode.IsSigned )
416411
{
417412
if ( rightTypeCode.IsSigned )
@@ -446,7 +441,6 @@ private static bool IntegerIntegerEquals( ulong left, ValueTypeCode leftTypeCode
446441
return left == right;
447442
}
448443
}
449-
// ReSharper restore RedundantIfElseBlock
450444
}
451445

452446
private static bool IntegerSingleEquals( MessagePackObject integer, MessagePackObject real )
@@ -458,7 +452,6 @@ private static bool IntegerSingleEquals( MessagePackObject integer, MessagePackO
458452
{
459453
return unchecked( ( long )integer._value ) == ( float )real;
460454
}
461-
// ReSharper disable once RedundantIfElseBlock
462455
else
463456
{
464457
return integer._value == ( float )real;
@@ -474,7 +467,6 @@ private static bool IntegerDoubleEquals( MessagePackObject integer, MessagePackO
474467
{
475468
return unchecked( ( long )integer._value ) == ( double )real;
476469
}
477-
// ReSharper disable once RedundantIfElseBlock
478470
else
479471
{
480472
return integer._value == ( double )real;
@@ -1010,7 +1002,6 @@ public Type UnderlyingType
10101002
}
10111003

10121004
var typeCode = this._handleOrTypeCode as ValueTypeCode;
1013-
// ReSharper disable RedundantIfElseBlock
10141005
if ( typeCode == null )
10151006
{
10161007
var asMps = this._handleOrTypeCode as MessagePackString;
@@ -1027,7 +1018,6 @@ public Type UnderlyingType
10271018
{
10281019
return typeCode.Type;
10291020
}
1030-
// ReSharper restore RedundantIfElseBlock
10311021
}
10321022
}
10331023

@@ -1262,7 +1252,6 @@ public string AsStringUtf16()
12621252
throw new InvalidOperationException( "Not UTF-16 string." );
12631253
}
12641254

1265-
// ReSharper disable RedundantIfElseBlock
12661255
if ( asBytes[ 0 ] == 0xff && asBytes[ 1 ] == 0xfe )
12671256
{
12681257
return Encoding.Unicode.GetString( asBytes, 2, asBytes.Length - 2 );
@@ -1275,7 +1264,6 @@ public string AsStringUtf16()
12751264
{
12761265
return Encoding.BigEndianUnicode.GetString( asBytes, 0, asBytes.Length );
12771266
}
1278-
// ReSharper restore RedundantIfElseBlock
12791267
}
12801268
catch ( ArgumentException ex )
12811269
{
@@ -1362,7 +1350,6 @@ private static void VerifyUnderlyingType<T>( MessagePackObject instance, string
13621350
{
13631351
throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, "Do not convert nil MessagePackObject to {0}.", typeof( T ) ), parameterName );
13641352
}
1365-
// ReSharper disable once RedundantIfElseBlock
13661353
else
13671354
{
13681355
ThrowCannotBeNilAs<T>();
@@ -1375,7 +1362,6 @@ private static void VerifyUnderlyingType<T>( MessagePackObject instance, string
13751362
{
13761363
throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, "Do not convert {0} MessagePackObject to {1}.", instance.UnderlyingType, typeof( T ) ), parameterName );
13771364
}
1378-
// ReSharper disable once RedundantIfElseBlock
13791365
else
13801366
{
13811367
ThrowInvalidTypeAs<T>( instance );
@@ -1394,7 +1380,6 @@ private static void ThrowInvalidTypeAs<T>( MessagePackObject instance )
13941380
{
13951381
throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "Do not convert {0} (binary:0x{2:x}) MessagePackObject to {1}.", instance.UnderlyingType, typeof( T ), instance._value ) );
13961382
}
1397-
// ReSharper disable once RedundantIfElseBlock
13981383
else
13991384
{
14001385
throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "Do not convert {0} MessagePackObject to {1}.", instance.UnderlyingType, typeof( T ) ) );
@@ -1423,7 +1408,6 @@ public static MessagePackObject FromObject( object boxedValue )
14231408

14241409
// Nullable<T> is boxed as null or underlying value type,
14251410
// so ( obj is Nullable<T> ) is always false.
1426-
// ReSharper disable RedundantIfElseBlock
14271411
if ( boxedValue == null )
14281412
{
14291413
return Nil;
@@ -1512,7 +1496,6 @@ public static MessagePackObject FromObject( object boxedValue )
15121496
{
15131497
return new MessagePackObject( ( MessagePackExtendedTypeObject )boxedValue );
15141498
}
1515-
// ReSharper restore RedundantIfElseBlock
15161499

15171500
throw new MessageTypeException( String.Format( CultureInfo.CurrentCulture, "Type '{0}' is not supported.", boxedValue.GetType() ) );
15181501
}

src/MsgPack/MessagePackObjectDictionary.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,14 +713,12 @@ public bool TryGetValue( MessagePackObject key, out MessagePackObject value )
713713
value = MessagePackObject.Nil;
714714
return false;
715715
}
716-
// ReSharper disable once RedundantIfElseBlock
717716
else
718717
{
719718
value = this._values[ index ];
720719
return true;
721720
}
722721
}
723-
// ReSharper disable once RedundantIfElseBlock
724722
else
725723
{
726724
return this._dictionary.TryGetValue( key, out value );

src/MsgPack/MessagePackString.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ private static bool MustBeString( string value )
413413
{
414414
return false;
415415
}
416-
// ReSharper disable once RedundantIfElseBlock
417416
else if ( 0x7E < c && c < 0xA0 )
418417
{
419418
return false;

src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`3.CommonConstructs.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ protected TConstruct EmitInvokeMethodExpression(
312312
/// <returns>The generated construct.</returns>
313313
private TConstruct EmitGetMemberValueExpression( TContext context, TConstruct instance, MemberInfo member )
314314
{
315-
// ReSharper disable RedundantIfElseBlock
316315
FieldInfo asField;
317316
if ( ( asField = member as FieldInfo ) != null )
318317
{
@@ -326,7 +325,6 @@ private TConstruct EmitGetMemberValueExpression( TContext context, TConstruct in
326325
#endif
327326
return this.EmitGetProperty( context, instance, asProperty, !asProperty.GetIsPublic() );
328327
}
329-
// ReSharper restore RedundantIfElseBlock
330328
}
331329

332330
private TConstruct EmitGetProperty( TContext context, TConstruct instance, PropertyInfo property, bool withReflection )
@@ -411,7 +409,6 @@ private TConstruct EmitSetMemberValueStatement( TContext context, TConstruct ins
411409
CollectionTraits traits;
412410
FieldInfo asField;
413411
PropertyInfo asProperty = null;
414-
// ReSharper disable RedundantIfElseBlock
415412
if ( ( asField = member as FieldInfo ) != null )
416413
{
417414
if ( !asField.IsInitOnly && asField.GetIsPublic() )
@@ -437,7 +434,6 @@ private TConstruct EmitSetMemberValueStatement( TContext context, TConstruct ins
437434
getCollection = this.EmitGetProperty( context, instance, asProperty, asProperty.GetIsPublic() );
438435
traits = asProperty.PropertyType.GetCollectionTraits();
439436
}
440-
// ReSharper restore RedundantIfElseBlock
441437

442438
// use Add(T) for appendable collection elementType read only member.
443439

@@ -1358,7 +1354,6 @@ TConstruct unpackedItem
13581354
{
13591355
if ( traits.AddMethod == null )
13601356
{
1361-
// ReSharper disable RedundantIfElseBlock
13621357
if ( member != null )
13631358
{
13641359
throw new SerializationException(
@@ -1380,7 +1375,6 @@ TConstruct unpackedItem
13801375
)
13811376
);
13821377
}
1383-
// ReSharper restore RedundantIfElseBlock
13841378
}
13851379

13861380
return

src/MsgPack/Serialization/DefaultSerializers/System_ArraySegment_1MessagePackSerializer`1.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ internal class System_ArraySegment_1MessagePackSerializer<T> : MessagePackSerial
3030

3131
private static Action<Packer, ArraySegment<T>, MessagePackSerializer<T>> InitializePacking()
3232
{
33-
// ReSharper disable RedundantIfElseBlock
3433
if ( typeof( T ) == typeof( byte ) )
3534
{
3635
return
@@ -49,12 +48,10 @@ private static Action<Packer, ArraySegment<T>, MessagePackSerializer<T>> Initial
4948
{
5049
return ArraySegmentMessageSerializer.PackGenericArraySegmentTo;
5150
}
52-
// ReSharper restore RedundantIfElseBlock
5351
}
5452

5553
private static Func<Unpacker, MessagePackSerializer<T>, ArraySegment<T>> InitializeUnacking()
5654
{
57-
// ReSharper disable RedundantIfElseBlock
5855
if ( typeof( T ) == typeof( byte ) )
5956
{
6057
return
@@ -73,7 +70,6 @@ private static Func<Unpacker, MessagePackSerializer<T>, ArraySegment<T>> Initial
7370
{
7471
return ArraySegmentMessageSerializer.UnpackGenericArraySegmentFrom;
7572
}
76-
// ReSharper restore RedundantIfElseBlock
7773
}
7874

7975
private readonly MessagePackSerializer<T> _itemSerializer;

src/MsgPack/Serialization/DefaultSerializers/System_ObjectMessagePackSerializer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ protected internal override void PackToCore( Packer packer, object value )
3636
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Asserted internally" )]
3737
protected internal override object UnpackFromCore( Unpacker unpacker )
3838
{
39-
// ReSharper disable RedundantIfElseBlock
4039
if ( unpacker.IsArrayHeader )
4140
{
4241
var result = new MessagePackObject[ UnpackHelpers.GetItemsCount( unpacker ) ];
@@ -78,7 +77,6 @@ protected internal override object UnpackFromCore( Unpacker unpacker )
7877
var result = unpacker.LastReadData;
7978
return result.IsNil ? MessagePackObject.Nil : result;
8079
}
81-
// ReSharper restore RedundantIfElseBlock
8280
}
8381
}
8482
}

src/MsgPack/Serialization/EmittingSerializers/ILEmittingSerializerBuilder`2.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ protected override ILConstruct MakeInt32Literal( TContext context, int constant
172172
}
173173
default:
174174
{
175-
// ReSharper disable RedundantIfElseBlock
176175
if ( 0 <= constant && constant <= 255 )
177176
{
178177
return ILConstruct.Literal( typeof( int ), constant, il => il.EmitLdc_I4_S( unchecked( ( byte )constant ) ) );
@@ -181,7 +180,6 @@ protected override ILConstruct MakeInt32Literal( TContext context, int constant
181180
{
182181
return ILConstruct.Literal( typeof( int ), constant, il => il.EmitLdc_I4( constant ) );
183182
}
184-
// ReSharper restore RedundantIfElseBlock
185183
}
186184
}
187185
}

0 commit comments

Comments
 (0)