mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Simplify parseHashTypeOpt
Remove redundant "else" after "return". Use std::nullopt to increase readability.
This commit is contained in:
parent
201c115c3e
commit
e9ddf0b400
1 changed files with 4 additions and 4 deletions
|
@ -389,10 +389,10 @@ Hash compressHash(const Hash & hash, unsigned int newSize)
|
||||||
std::optional<HashType> parseHashTypeOpt(std::string_view s)
|
std::optional<HashType> parseHashTypeOpt(std::string_view s)
|
||||||
{
|
{
|
||||||
if (s == "md5") return htMD5;
|
if (s == "md5") return htMD5;
|
||||||
else if (s == "sha1") return htSHA1;
|
if (s == "sha1") return htSHA1;
|
||||||
else if (s == "sha256") return htSHA256;
|
if (s == "sha256") return htSHA256;
|
||||||
else if (s == "sha512") return htSHA512;
|
if (s == "sha512") return htSHA512;
|
||||||
else return std::optional<HashType> {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashType parseHashType(std::string_view s)
|
HashType parseHashType(std::string_view s)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue