From 656f909fb0b4a9b3b7f1436210523faa62902158 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sun, 19 Jun 2022 00:41:30 -0400 Subject: [PATCH] Enable IDE0071 (Simplify interpolation) (#70918) --- eng/CodeAnalysis.src.globalconfig | 2 +- .../CSharp/RuntimeBinder/ComInterop/IDispatchComObject.cs | 2 +- .../src/System/Drawing/Printing/PaperSize.cs | 2 +- .../System.Drawing.Common/src/System/Drawing/StringFormat.cs | 2 +- .../System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig index aba919edc30..2048d996c4b 100644 --- a/eng/CodeAnalysis.src.globalconfig +++ b/eng/CodeAnalysis.src.globalconfig @@ -1501,7 +1501,7 @@ dotnet_diagnostic.IDE0066.severity = suggestion dotnet_diagnostic.IDE0070.severity = suggestion # IDE0071: Simplify interpolation -dotnet_diagnostic.IDE0071.severity = suggestion +dotnet_diagnostic.IDE0071.severity = warning # IDE0072: Add missing cases dotnet_diagnostic.IDE0072.severity = silent diff --git a/src/libraries/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ComInterop/IDispatchComObject.cs b/src/libraries/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ComInterop/IDispatchComObject.cs index cc7f6cece9d..1c0bd12712d 100644 --- a/src/libraries/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ComInterop/IDispatchComObject.cs +++ b/src/libraries/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ComInterop/IDispatchComObject.cs @@ -101,7 +101,7 @@ namespace Microsoft.CSharp.RuntimeBinder.ComInterop typeName = "IDispatch"; } - return $"{RuntimeCallableWrapper.ToString()} ({typeName})"; + return $"{RuntimeCallableWrapper} ({typeName})"; } public ComTypeDesc ComTypeDesc diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs index 4b9b49ae33d..75e69bb466a 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs @@ -127,6 +127,6 @@ namespace System.Drawing.Printing /// /// Provides some interesting information about the PaperSize in String form. /// - public override string ToString() => $"[PaperSize {PaperName} Kind={Kind.ToString()} Height={Height.ToString(CultureInfo.InvariantCulture)} Width={Width.ToString(CultureInfo.InvariantCulture)}]"; + public override string ToString() => $"[PaperSize {PaperName} Kind={Kind} Height={Height.ToString(CultureInfo.InvariantCulture)} Width={Width.ToString(CultureInfo.InvariantCulture)}]"; } } diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs index be9245ae46e..c22bba3ba6b 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs @@ -437,6 +437,6 @@ namespace System.Drawing /// /// Converts this to a human-readable string. /// - public override string ToString() => $"[StringFormat, FormatFlags={FormatFlags.ToString()}]"; + public override string ToString() => $"[StringFormat, FormatFlags={FormatFlags}]"; } } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs index 22306fd911c..671e88c73cc 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs @@ -1414,7 +1414,7 @@ namespace System.Net.Http { if (NetEventSource.Log.IsEnabled()) { - Trace($"Connected with custom SslStream: alpn='${sslStream.NegotiatedApplicationProtocol.ToString()}'"); + Trace($"Connected with custom SslStream: alpn='${sslStream.NegotiatedApplicationProtocol}'"); } } transportContext = sslStream.TransportContext;