style: remove redundant else branches

This commit is contained in:
Oliver Booth 2023-04-01 22:01:07 +01:00
parent d7bf9d1788
commit b79435211a
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025
1 changed files with 23 additions and 35 deletions

View File

@ -1,4 +1,4 @@
using System.Diagnostics.Contracts; using System.Diagnostics.Contracts;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Web; using System.Web;
@ -70,11 +70,9 @@ public static class DictionaryExtensions
return updated; return updated;
} }
else
{
dictionary.Add(key, addValue); dictionary.Add(key, addValue);
return addValue; return addValue;
}
#endif #endif
} }
@ -126,12 +124,10 @@ public static class DictionaryExtensions
return updated; return updated;
} }
else
{
dictionary.Add(key, addValue); dictionary.Add(key, addValue);
return addValue; return addValue;
} }
}
/// <summary> /// <summary>
/// Uses the specified functions to add a key/value pair to the <see cref="Dictionary{TKey,TValue}" /> if the key does /// Uses the specified functions to add a key/value pair to the <see cref="Dictionary{TKey,TValue}" /> if the key does
@ -202,13 +198,11 @@ public static class DictionaryExtensions
return updated; return updated;
} }
else
{
var add = addValueFactory(key); var add = addValueFactory(key);
dictionary.Add(key, add); dictionary.Add(key, add);
return add; return add;
}
#endif #endif
} }
@ -268,14 +262,12 @@ public static class DictionaryExtensions
return updated; return updated;
} }
else
{
var add = addValueFactory(key); var add = addValueFactory(key);
dictionary.Add(key, add); dictionary.Add(key, add);
return add; return add;
} }
}
/// <summary> /// <summary>
/// Uses the specified functions and argument to add a key/value pair to the <see cref="Dictionary{TKey,TValue}" /> if /// Uses the specified functions and argument to add a key/value pair to the <see cref="Dictionary{TKey,TValue}" /> if
@ -352,13 +344,11 @@ public static class DictionaryExtensions
return updated; return updated;
} }
else
{
var add = addValueFactory(key, factoryArgument); var add = addValueFactory(key, factoryArgument);
dictionary.Add(key, add); dictionary.Add(key, add);
return add; return add;
}
#endif #endif
} }
@ -424,14 +414,12 @@ public static class DictionaryExtensions
return updated; return updated;
} }
else
{
var add = addValueFactory(key, factoryArgument); var add = addValueFactory(key, factoryArgument);
dictionary.Add(key, add); dictionary.Add(key, add);
return add; return add;
} }
}
/// <summary> /// <summary>
/// Converts an <see cref="IEnumerable{T}" /> of <see cref="KeyValuePair{TKey, TValue}" /> to a data connection /// Converts an <see cref="IEnumerable{T}" /> of <see cref="KeyValuePair{TKey, TValue}" /> to a data connection