-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adds consider replacing switch statement with switch expression
- Loading branch information
Showing
4 changed files
with
60 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...gestions/ConsiderReplacingSwitchStatementContainingOnlyAssignmentsWithSwitchExpression.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Sharpen.Engine.SharpenSuggestions.CSharp80.SwitchExpressions.Suggestions | ||
{ | ||
internal sealed class ConsiderReplacingSwitchStatementContainingOnlyAssignmentsWithSwitchExpression : ISharpenSuggestion | ||
{ | ||
private ConsiderReplacingSwitchStatementContainingOnlyAssignmentsWithSwitchExpression() { } | ||
|
||
public string MinimumLanguageVersion { get; } = CSharpLanguageVersions.CSharp80; | ||
|
||
public ICSharpFeature LanguageFeature { get; } = CSharpFeatures.SwitchExpressions.Instance; | ||
|
||
public string FriendlyName { get; } = "Consider replacing switch statement containing only assignments with switch expression"; | ||
|
||
public static readonly ConsiderReplacingSwitchStatementContainingOnlyAssignmentsWithSwitchExpression Instance = new ConsiderReplacingSwitchStatementContainingOnlyAssignmentsWithSwitchExpression(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
.../Suggestions/ConsiderReplacingSwitchStatementContainingOnlyReturnsWithSwitchExpression.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Sharpen.Engine.SharpenSuggestions.CSharp80.SwitchExpressions.Suggestions | ||
{ | ||
internal sealed class ConsiderReplacingSwitchStatementContainingOnlyReturnsWithSwitchExpression : ISharpenSuggestion | ||
{ | ||
private ConsiderReplacingSwitchStatementContainingOnlyReturnsWithSwitchExpression() { } | ||
|
||
public string MinimumLanguageVersion { get; } = CSharpLanguageVersions.CSharp80; | ||
|
||
public ICSharpFeature LanguageFeature { get; } = CSharpFeatures.SwitchExpressions.Instance; | ||
|
||
public string FriendlyName { get; } = "Consider replacing switch statement containing only returns with switch expression"; | ||
|
||
public static readonly ConsiderReplacingSwitchStatementContainingOnlyReturnsWithSwitchExpression Instance = new ConsiderReplacingSwitchStatementContainingOnlyReturnsWithSwitchExpression(); | ||
} | ||
} |