diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-02 15:52:13 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-02 15:52:13 +0000 |
commit | 450dcf2c1b60a36f5ffeab2411805287d122bcdd (patch) | |
tree | d1fe49020e97198147483f42454da46f36e42094 /src/nix/hash.cc | |
parent | 6dd471ebf6b9a4996405398093ccb371b8abdf2f (diff) |
Remove `HashType::Unknown`
Instead, `Hash` uses `std::optional<HashType>`. In the future, we may
also make `Hash` itself require a known hash type, encoraging people to
use `std::optional<Hash>` instead.
Diffstat (limited to 'src/nix/hash.cc')
-rw-r--r-- | src/nix/hash.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/nix/hash.cc b/src/nix/hash.cc index 3362ffd0d..4980cd198 100644 --- a/src/nix/hash.cc +++ b/src/nix/hash.cc @@ -79,7 +79,7 @@ static RegisterCommand r2("hash-path", [](){ return make_ref<CmdHash>(FileIngest struct CmdToBase : Command { Base base; - HashType ht = HashType::Unknown; + HashType ht; std::vector<std::string> args; CmdToBase(Base base) : base(base) @@ -132,8 +132,6 @@ static int compatNixHash(int argc, char * * argv) else if (*arg == "--type") { string s = getArg(*arg, arg, end); ht = parseHashType(s); - if (ht == HashType::Unknown) - throw UsageError(format("unknown hash type '%1%'") % s); } else if (*arg == "--to-base16") op = opTo16; else if (*arg == "--to-base32") op = opTo32; |