Remove unused locals in System.Security namespaces
authorMatt Kotsenas <mattkot@microsoft.com>
Tue, 11 Aug 2020 16:02:41 +0000 (09:02 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Aug 2020 16:02:41 +0000 (09:02 -0700)
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs
src/libraries/System.Security.AccessControl/src/System/Security/AccessControl/ACL.cs
src/libraries/System.Security.AccessControl/tests/RawAcl/RawAcl_RemoveAce.cs

index 85bdd12..891fbae 100644 (file)
@@ -610,7 +610,7 @@ namespace System.Security.Cryptography.Rsa.Tests
                 byte[] crypt = Encrypt(rsa, TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1);
 
                 // Export the key, this should not clear/destroy the key.
-                RSAParameters ignored = rsa.ExportParameters(true);
+                rsa.ExportParameters(true);
                 output = Decrypt(rsa, crypt, RSAEncryptionPadding.OaepSHA1);
             }
 
index 7f4c20d..16dd918 100644 (file)
@@ -587,7 +587,6 @@ namespace System.Security.AccessControl
 
         public void RemoveAce(int index)
         {
-            GenericAce ace = _aces[index];
             _aces.RemoveAt(index);
         }
 
index 3c385bc..0cd61bc 100644 (file)
@@ -35,11 +35,22 @@ namespace System.Security.AccessControl.Tests
             count = rawAcl.Count;
 
             //test remove at -1
-            Assert.Throws<ArgumentOutOfRangeException>(() =>
-            {
-                index = -1;
-                rawAcl.RemoveAce(index);
-            });
+            AssertExtensions.Throws<ArgumentOutOfRangeException>(
+                "index",
+                () =>
+                {
+                    index = -1;
+                    rawAcl.RemoveAce(index);
+                });
+
+            //test remove at value too large
+            AssertExtensions.Throws<ArgumentOutOfRangeException>(
+                "index",
+                () =>
+                {
+                    index = int.MaxValue;
+                    rawAcl.RemoveAce(index);
+                });
 
             //test remove at 0, only need to catch ArgumentOutOfRangeException if Count = 0
             index = 0;