diff --git a/src/Polly/Polly.csproj b/src/Polly/Polly.csproj index 177c9f8b3a0..eb32b068d82 100644 --- a/src/Polly/Polly.csproj +++ b/src/Polly/Polly.csproj @@ -8,7 +8,7 @@ 70 true $(NoWarn);CA1010;CA1031;CA1051;CA1062;CA1063;CA1064;CA1710;CA1716;CA1724;CA1805;CA1815;CA1816;CA2211 - $(NoWarn);S2223;S3215;S3246;S3971;S4039;S4457 + $(NoWarn);S2223;S3246;S3971;S4039;S4457 $(NoWarn);RS0037; diff --git a/src/Polly/Wrap/IAsyncPolicyPolicyWrapExtensions.cs b/src/Polly/Wrap/IAsyncPolicyPolicyWrapExtensions.cs index 2e62bd01f35..1335c57a596 100644 --- a/src/Polly/Wrap/IAsyncPolicyPolicyWrapExtensions.cs +++ b/src/Polly/Wrap/IAsyncPolicyPolicyWrapExtensions.cs @@ -18,7 +18,7 @@ public static AsyncPolicyWrap WrapAsync(this IAsyncPolicy outerPolicy, IAsyncPol throw new ArgumentNullException(nameof(outerPolicy)); } - return ((AsyncPolicy)outerPolicy).WrapAsync(innerPolicy); + return outerPolicy.WrapAsync(innerPolicy); } /// @@ -35,7 +35,7 @@ public static AsyncPolicyWrap WrapAsync(this IAsyncPolicy oute throw new ArgumentNullException(nameof(outerPolicy)); } - return ((AsyncPolicy)outerPolicy).WrapAsync(innerPolicy); + return outerPolicy.WrapAsync(innerPolicy); } /// @@ -52,7 +52,7 @@ public static AsyncPolicyWrap WrapAsync(this IAsyncPolicy)outerPolicy).WrapAsync(innerPolicy); + return outerPolicy.WrapAsync(innerPolicy); } /// @@ -69,7 +69,7 @@ public static AsyncPolicyWrap WrapAsync(this IAsyncPolicy)outerPolicy).WrapAsync(innerPolicy); + return outerPolicy.WrapAsync(innerPolicy); } } @@ -148,6 +148,7 @@ public AsyncPolicyWrap WrapAsync(IAsyncPolicy innerPolicy) } } +#pragma warning disable S3215 // "interface" instances should not be cast to concrete types public partial class Policy { private const int MinimumPoliciesRequiredForWrap = 2; @@ -181,3 +182,4 @@ public static AsyncPolicyWrap WrapAsync(params IAsyncPolicy WrapAsync(policies[0], WrapAsync(policies.Skip(1).ToArray())), }; } +#pragma warning restore S3215 // "interface" instances should not be cast to concrete types diff --git a/src/Polly/Wrap/ISyncPolicyPolicyWrapExtensions.cs b/src/Polly/Wrap/ISyncPolicyPolicyWrapExtensions.cs index 08b35c73fb6..faca18f7623 100644 --- a/src/Polly/Wrap/ISyncPolicyPolicyWrapExtensions.cs +++ b/src/Polly/Wrap/ISyncPolicyPolicyWrapExtensions.cs @@ -18,7 +18,7 @@ public static PolicyWrap Wrap(this ISyncPolicy outerPolicy, ISyncPolicy innerPol throw new ArgumentNullException(nameof(outerPolicy)); } - return ((Policy)outerPolicy).Wrap(innerPolicy); + return outerPolicy.Wrap(innerPolicy); } /// @@ -35,7 +35,7 @@ public static PolicyWrap Wrap(this ISyncPolicy outerPolicy, IS throw new ArgumentNullException(nameof(outerPolicy)); } - return ((Policy)outerPolicy).Wrap(innerPolicy); + return outerPolicy.Wrap(innerPolicy); } /// @@ -52,7 +52,7 @@ public static PolicyWrap Wrap(this ISyncPolicy outerP throw new ArgumentNullException(nameof(outerPolicy)); } - return ((Policy)outerPolicy).Wrap(innerPolicy); + return outerPolicy.Wrap(innerPolicy); } /// @@ -69,7 +69,7 @@ public static PolicyWrap Wrap(this ISyncPolicy outerP throw new ArgumentNullException(nameof(outerPolicy)); } - return ((Policy)outerPolicy).Wrap(innerPolicy); + return outerPolicy.Wrap(innerPolicy); } } @@ -148,6 +148,7 @@ public PolicyWrap Wrap(ISyncPolicy innerPolicy) } } +#pragma warning disable S3215 // "interface" instances should not be cast to concrete types public partial class Policy { /// @@ -179,3 +180,4 @@ public static PolicyWrap Wrap(params ISyncPolicy[] po _ => Wrap(policies[0], Wrap(policies.Skip(1).ToArray())), }; } +#pragma warning restore S3215 // "interface" instances should not be cast to concrete types