From 5490a98ab50d58caf14a18b6b6aad4c4e678dfdd Mon Sep 17 00:00:00 2001 From: Samuel Lucas <63159663+samuel-lucas6@users.noreply.github.com> Date: Sat, 13 May 2023 14:27:52 +0100 Subject: [PATCH] src: Consistent curly braces for loops. --- src/Geralt.Tests/SpansTests.cs | 3 +-- src/Geralt/Crypto/BLAKE2b.cs | 3 +-- src/Geralt/Crypto/SecureRandom.cs | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Geralt.Tests/SpansTests.cs b/src/Geralt.Tests/SpansTests.cs index 10bf817..f8bcda9 100644 --- a/src/Geralt.Tests/SpansTests.cs +++ b/src/Geralt.Tests/SpansTests.cs @@ -71,8 +71,7 @@ private static T[] Concat(params T[][] arrays) { int offset = 0; var result = new T[arrays.Sum(array => array.Length)]; - foreach (var array in arrays) - { + foreach (var array in arrays) { Array.Copy(array, sourceIndex: 0, result, offset, array.Length); offset += array.Length; } diff --git a/src/Geralt/Crypto/BLAKE2b.cs b/src/Geralt/Crypto/BLAKE2b.cs index 3422612..aa3d675 100644 --- a/src/Geralt/Crypto/BLAKE2b.cs +++ b/src/Geralt/Crypto/BLAKE2b.cs @@ -36,8 +36,7 @@ public static void ComputeHash(Span hash, Stream message) int bytesRead; Span buffer = new byte[StreamBufferSize]; using var blake2b = new IncrementalBLAKE2b(hash.Length); - while ((bytesRead = message.Read(buffer)) > 0) - { + while ((bytesRead = message.Read(buffer)) > 0) { blake2b.Update(buffer[..bytesRead]); } CryptographicOperations.ZeroMemory(buffer); diff --git a/src/Geralt/Crypto/SecureRandom.cs b/src/Geralt/Crypto/SecureRandom.cs index 4fcbd4e..83d1364 100644 --- a/src/Geralt/Crypto/SecureRandom.cs +++ b/src/Geralt/Crypto/SecureRandom.cs @@ -47,8 +47,7 @@ public static string GetString(int length, string characterSet = AlphanumericCha Validation.SizeBetween(nameof(length), length, MinStringLength, MaxStringLength); Validation.NotNullOrEmpty(nameof(characterSet), characterSet); var stringBuilder = new StringBuilder(); - for (int i = 0; i < length; i++) - { + for (int i = 0; i < length; i++) { stringBuilder.Append(characterSet[GetInt32(characterSet.Length)]); } return stringBuilder.ToString(); @@ -61,8 +60,7 @@ public static char[] GetPassphrase(int wordCount, char separatorChar = '-', bool int numberIndex = 0; if (includeNumber) { numberIndex = GetInt32(wordCount); } var passphrase = new List(); - for (int i = 0; i < wordCount; i++) - { + for (int i = 0; i < wordCount; i++) { int randomIndex = GetInt32(wordlist.Length); passphrase.AddRange(capitalize ? CultureInfo.InvariantCulture.TextInfo.ToTitleCase(wordlist[randomIndex]) : wordlist[randomIndex]); if (includeNumber && i == numberIndex) { passphrase.Add(char.Parse(GetInt32(NumericChars.Length).ToString())); }