csharpier
csharpier copied to clipboard
Inconsistent line breaks with lambda notation
private bool ShouldNotBeDescribedKind(ITypeDefinition typeDefinition) =>
typeDefinition.Kind switch
{
TypeKind.Class => (_configuration.Kinds & DescribeKind.Class) != DescribeKind.Class,
TypeKind.Interface
=> (_configuration.Kinds & DescribeKind.Interface) != DescribeKind.Interface,
TypeKind.Struct => (_configuration.Kinds & DescribeKind.Struct) != DescribeKind.Struct,
TypeKind.Delegate
=> (_configuration.Kinds & DescribeKind.Delegate) != DescribeKind.Delegate,
TypeKind.Enum => (_configuration.Kinds & DescribeKind.Enum) != DescribeKind.Enum,
TypeKind.Void
or TypeKind.NInt
or TypeKind.NUInt
or TypeKind.FunctionPointer
=> throw new UnreachableException(),
_ => true,
};
In my opinion these are several very similar errors.
- lambda notation for methods is wrapped after the
=>
. - lambda notation for switch cases is wrapped before the
=>
, if line length is too long. - lambda notation for switch cases will wrap before
=>
, if pattern matching.
This does not correspond to the expected behavior. Basically I would expect either a consistent wrap before or after =>
. In the special case of the switch case notation, even always independent of the line length.
related #205
related #348
Also related: #836
I personally would like all three cases to break after =>
.