Skip to content

Commit 5435a8e

Browse files
R# remove redundant
1 parent ad09c0d commit 5435a8e

7 files changed

Lines changed: 7 additions & 13 deletions

CodeConverter/CSharp/ExpressionNodeVisitor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ private CSharpSyntaxNode InterpolatedString(SyntaxList<InterpolatedStringContent
144144
.WithArgumentList(ExpressionSyntaxExtensions.CreateArgList(interpolatedString));
145145
}
146146

147-
private static InterpolatedStringTextSyntax InterpolatedStringText(string text) =>
148-
SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(SyntaxFactory.TriviaList(), SyntaxKind.InterpolatedStringTextToken, text, text, SyntaxFactory.TriviaList()));
149-
150147
public override async Task<CSharpSyntaxNode> VisitXmlString(VBasic.Syntax.XmlStringSyntax node) =>
151148
CommonConversions.Literal(node.TextTokens.Aggregate("", (a, b) => a + LiteralConversions.EscapeVerbatimQuotes(b.Text)));
152149

CodeConverter/CSharp/MethodInfoExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private static Func<TDesiredTarget, TDesiredReturn> CreateWeaklyTypedDelegateFor
2424

2525
{
2626
var func = method.CreateOpenDelegate<Func<TTarget, TReturn>>();
27-
return (TDesiredTarget target) => target is TTarget tt ? (TDesiredReturn)(object)func(tt) : default;
27+
return target => target is TTarget tt ? (TDesiredReturn)func(tt) : default;
2828
}
2929

3030
/// <summary>
@@ -38,7 +38,7 @@ private static Func<TDesiredTarget, TDesiredParam, TDesiredReturn> CreateWeaklyT
3838
{
3939
var paramIsReferenceType = default(TParam) == null;
4040
var func = method.CreateOpenDelegate<Func<TTarget, TParam, TReturn>>();
41-
return (TDesiredTarget target, TDesiredParam param) => {
41+
return (target, param) => {
4242
var desiredParam = paramIsReferenceType ? param is TParam p ? p : default : (TParam)(object)param;
4343
return target is TTarget desiredTarget ? (TDesiredReturn)(object)func(desiredTarget, desiredParam) : default;
4444
};

CodeConverter/CSharp/VisualBasicEqualityComparison.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static ExpressionSyntax NegateIfNeeded(VBSyntax.BinaryExpressionSyntax n
204204
{
205205
return node.IsKind(VBasic.SyntaxKind.NotEqualsExpression)
206206
? Negate(positiveExpression)
207-
: (ExpressionSyntax)positiveExpression;
207+
: positiveExpression;
208208
}
209209

210210
private static PrefixUnaryExpressionSyntax Negate(InvocationExpressionSyntax positiveExpression)
@@ -238,7 +238,7 @@ public ExpressionSyntax GetFullExpressionForVbObjectComparison(ExpressionSyntax
238238
var compareObject = SyntaxFactory.InvocationExpression(ValidSyntaxFactory.MemberAccess(nameof(Operators), nameof(Operators.ConditionalCompareObjectEqual)),
239239
SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList(new[]
240240
{SyntaxFactory.Argument(lhs), SyntaxFactory.Argument(rhs), optionCompareTextCaseInsensitive})));
241-
return negate ? (ExpressionSyntax)Negate(compareObject) : compareObject;
241+
return negate ? Negate(compareObject) : compareObject;
242242
}
243243

244244
private static BinaryExpressionSyntax GetCompareTextCaseInsensitiveCompareOptions()

CodeConverter/Shared/DocumentExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static async Task<Document> SimplifyStatementsAsync<TUsingDirectiveSyntax
1313
{
1414
Func<SyntaxNode, bool> wouldBeSimplifiedIncorrectly =
1515
convertedDocument.Project.Language == LanguageNames.VisualBasic
16-
? (Func<SyntaxNode, bool>) VbWouldBeSimplifiedIncorrectly
16+
? VbWouldBeSimplifiedIncorrectly
1717
: CsWouldBeSimplifiedIncorrectly;
1818
var originalRoot = await convertedDocument.GetSyntaxRootAsync();
1919
var nodesWithUnresolvedTypes = (await convertedDocument.GetSemanticModelAsync()).GetDiagnostics()

CodeConverter/Shared/TextConversionOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
public class TextConversionOptions : SingleConversionOptions
44
{
5-
private readonly ConversionOptions _conversionOptions;
6-
75
public TextConversionOptions(IReadOnlyCollection<PortableExecutableReference> references, string sourceFilePath = null)
86
{
97
References = references;
108
SourceFilePath = sourceFilePath;
11-
_conversionOptions = new ConversionOptions();
129
}
1310

1411
public IReadOnlyCollection<PortableExecutableReference> References { get; }

CodeConverter/Util/ExpressionSyntaxExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static ArgumentListSyntax CreateArgList(params ExpressionSyntax[] args)
1212

1313
public static VBSyntax.ArgumentListSyntax CreateArgList<T>(params T[] args) where T : VBSyntax.ExpressionSyntax
1414
{
15-
return CreateVbArgList((IEnumerable<T>) args);
15+
return CreateVbArgList(args);
1616
}
1717

1818
public static VBSyntax.ArgumentListSyntax CreateVbArgList<T>(this IEnumerable<T> argExpressions) where T : VBSyntax.ExpressionSyntax

CodeConverter/Util/SyntaxTriviaExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal static class SyntaxTriviaExtensions
3131

3232
public static CS.SyntaxKind? GetCSKind(this SyntaxTrivia t)
3333
{
34-
return VBToCSSyntaxKinds.TryGetValue(VBasic.VisualBasicExtensions.Kind(t), out var csKind) ? csKind : (CS.SyntaxKind?)null;
34+
return VBToCSSyntaxKinds.TryGetValue(VBasic.VisualBasicExtensions.Kind(t), out var csKind) ? csKind : null;
3535
}
3636

3737
/// <remarks>Good candidate for unit testing to catch newline issues hidden by the test harness</remarks>

0 commit comments

Comments
 (0)