Skip to content

Commit

Permalink
style: format code with dotnet-format
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 70a4a67 according to the output
from dotnet-format.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Jan 24, 2024
1 parent 70a4a67 commit 4b34970
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public sealed class NotNullAttribute() : Attribute
/// returns this value, the associated parameter will not be null.
/// </param>
public NotNullAttribute(bool returnValue)
: this() => ReturnValue = returnValue;

/// <summary>
/// Gets the return value condition.
/// </summary>
public bool ReturnValue { get; }
: this() => ReturnValue = returnValue;

/// <summary>
/// Gets the return value condition.
/// </summary>
public bool ReturnValue { get; }
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace System.Diagnostics.CodeAnalysis;
)]
public sealed class SetsRequiredMembersAttribute(params string[] members) : Attribute
{
public string[] Members { get; } = members;

public SetsRequiredMembersAttribute()
: this(null as string[]) { }

public SetsRequiredMembersAttribute(string members)
: this(new[] { members }) { }
public string[] Members { get; } = members;

public SetsRequiredMembersAttribute()
: this(null as string[]) { }

public SetsRequiredMembersAttribute(string members)
: this(new[] { members }) { }
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public // polyfill!
sealed class ValidatedNotNullAttribute : Attribute { }
sealed class ValidatedNotNullAttribute : Attribute
{ }
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ public sealed class CompilerFeatureRequiredAttribute(string? featureName, bool i
: Attribute
{
public CompilerFeatureRequiredAttribute(string? featureName)
: this(featureName, false) { }

public CompilerFeatureRequiredAttribute()
: this(null) { }

/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);

/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);

/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; } = featureName;

/// <summary>
/// If <see langword="true" />, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; } = isOptional;
: this(featureName, false) { }

public CompilerFeatureRequiredAttribute()
: this(null) { }

/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);

/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);

/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; } = featureName;

/// <summary>
/// If <see langword="true" />, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; } = isOptional;
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -862,76 +862,76 @@ private unsafe string AllocateStringForNameIndex(int index, out int dataOffset)
return _store.ReadDouble();
case ResourceTypeCode.Decimal:
return _store.ReadDecimal();
case ResourceTypeCode.DateTime:
{
long dateData = _store.ReadInt64();
return DateTime.FromBinary(dateData);
}
case ResourceTypeCode.TimeSpan:
{
long ticks = _store.ReadInt64();
return new TimeSpan(ticks);
}
case ResourceTypeCode.ByteArray:
{
int num2 = _store.ReadInt32();
if (num2 < 0)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2)
);
case ResourceTypeCode.DateTime:
{
long dateData = _store.ReadInt64();
return DateTime.FromBinary(dateData);
}
if (_ums == null)
{
if (num2 > _store.BaseStream.Length)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2)
);
}
return _store.ReadBytes(num2);
case ResourceTypeCode.TimeSpan:
{
long ticks = _store.ReadInt64();
return new TimeSpan(ticks);
}
if (num2 > _ums.Length - _ums.Position)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2)
);
case ResourceTypeCode.ByteArray:
{
int num2 = _store.ReadInt32();
if (num2 < 0)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2)
);
}
if (_ums == null)
{
if (num2 > _store.BaseStream.Length)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2)
);
}
return _store.ReadBytes(num2);
}
if (num2 > _ums.Length - _ums.Position)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2)
);
}
byte[] array2 = new byte[num2];
int num3 = _ums.Read(array2, 0, num2);
return array2;
}
byte[] array2 = new byte[num2];
int num3 = _ums.Read(array2, 0, num2);
return array2;
}
case ResourceTypeCode.Stream:
{
int num = _store.ReadInt32();
if (num < 0)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num)
);
case ResourceTypeCode.Stream:
{
int num = _store.ReadInt32();
if (num < 0)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num)
);
}
if (_ums == null)
{
byte[] array = _store.ReadBytes(num);
return new MemoryStream(array);
}
if (num > _ums.Length - _ums.Position)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num)
);
}
return new UnmanagedMemoryStream(_ums.PositionPointer, num, num, FileAccess.Read);
}
if (_ums == null)
{
byte[] array = _store.ReadBytes(num);
return new MemoryStream(array);
default:
{
if (typeCode < ResourceTypeCode.StartOfUserTypes)
{
throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch);
}
int typeIndex = (int)(typeCode - 64);
return DeserializeObject(typeIndex);
}
if (num > _ums.Length - _ums.Position)
{
throw new BadImageFormatException(
SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num)
);
}
return new UnmanagedMemoryStream(_ums.PositionPointer, num, num, FileAccess.Read);
}
default:
{
if (typeCode < ResourceTypeCode.StartOfUserTypes)
{
throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch);
}
int typeIndex = (int)(typeCode - 64);
return DeserializeObject(typeIndex);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public sealed class NotNullAttribute() : Attribute
/// returns this value, the associated parameter will not be null.
/// </param>
public NotNullAttribute(bool returnValue)
: this() => ReturnValue = returnValue;

/// <summary>
/// Gets the return value condition.
/// </summary>
public bool ReturnValue { get; }
: this() => ReturnValue = returnValue;

/// <summary>
/// Gets the return value condition.
/// </summary>
public bool ReturnValue { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ namespace System.Diagnostics.CodeAnalysis;
)]
public sealed class SetsRequiredMembersAttribute(params string[] members) : Attribute
{
public string[] Members { get; } = members;

public SetsRequiredMembersAttribute()
: this(null as string[]) { }

public SetsRequiredMembersAttribute(string members)
: this(new[] { members }) { }
public string[] Members { get; } = members;

public SetsRequiredMembersAttribute()
: this(null as string[]) { }

public SetsRequiredMembersAttribute(string members)
: this(new[] { members }) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ public sealed class CompilerFeatureRequiredAttribute(string? featureName, bool i
: Attribute
{
public CompilerFeatureRequiredAttribute(string? featureName)
: this(featureName, false) { }

public CompilerFeatureRequiredAttribute()
: this(null) { }

/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);

/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);

/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; } = featureName;

/// <summary>
/// If <see langword="true" />, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; } = isOptional;
: this(featureName, false) { }

public CompilerFeatureRequiredAttribute()
: this(null) { }

/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);

/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);

/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; } = featureName;

/// <summary>
/// If <see langword="true" />, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; } = isOptional;
}

0 comments on commit 4b34970

Please sign in to comment.