diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-03-18 08:57:02 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-03-18 08:59:31 +0100 |
commit | 9870dd0967f33d9f8bf0279eaa03294da0b55148 (patch) | |
tree | fac285d2dd8b5116ead70e5c33bbe3d75e433b09 /src/commands/tree_of.rs | |
parent | 13a85ddc5768a25f985eeb7b7dd1a8de5dce87d6 (diff) |
Rewrite PackageVersionConstraint constructing
Use the TryFrom trait rather than a `::new()` constructor that can fail.
This is way more idomatic.
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/commands/tree_of.rs')
-rw-r--r-- | src/commands/tree_of.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/commands/tree_of.rs b/src/commands/tree_of.rs index 30196b7..10e51d3 100644 --- a/src/commands/tree_of.rs +++ b/src/commands/tree_of.rs @@ -8,6 +8,8 @@ // SPDX-License-Identifier: EPL-2.0 // +use std::convert::TryFrom; + use anyhow::Error; use anyhow::Result; use clap::ArgMatches; @@ -31,8 +33,7 @@ pub async fn tree_of( .map(PackageName::from); let pvers = matches .value_of("package_version") - .map(String::from) - .map(PackageVersionConstraint::new) + .map(PackageVersionConstraint::try_from) .transpose()?; repo.packages() |