summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-01-21 09:07:20 +0200
committerLars Wirzenius <liw@liw.fi>2022-01-21 09:07:20 +0200
commita73712df8840c63210ce8aceed9d0738931e5317 (patch)
tree26ff0fec7701f6d97f9ec9e3e9dd96ed7c228057
parent360339dbd0f4a61fd840cb3ef2a756065593b950 (diff)
downloadroadmap-a73712df8840c63210ce8aceed9d0738931e5317.tar.gz
refactor: format code with rustfmt
Sponsored-by: author
-rw-r--r--src/bin/roadmap2dot.rs2
-rw-r--r--src/err.rs10
-rw-r--r--src/map.rs10
-rw-r--r--src/parser.rs2
4 files changed, 8 insertions, 16 deletions
diff --git a/src/bin/roadmap2dot.rs b/src/bin/roadmap2dot.rs
index b180da8..a9b7302 100644
--- a/src/bin/roadmap2dot.rs
+++ b/src/bin/roadmap2dot.rs
@@ -11,12 +11,12 @@
//! test the library crate. It is expected that serious use of the
//! crate will be as a library.
+use anyhow::Result;
use roadmap::from_yaml;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use structopt::StructOpt;
-use anyhow::Result;
const LABEL_WIDTH: usize = 30;
diff --git a/src/err.rs b/src/err.rs
index b928b09..c5210f1 100644
--- a/src/err.rs
+++ b/src/err.rs
@@ -7,16 +7,10 @@ pub enum RoadmapError {
NoGoals,
#[error("too many goals, must have exactly one: found {count:}: {}", .names.join(", "))]
- ManyGoals {
- count: usize,
- names: Vec<String>,
- },
+ ManyGoals { count: usize, names: Vec<String> },
#[error("step {name:} depends on missing {missing:}")]
- MissingDep {
- name: String,
- missing: String,
- },
+ MissingDep { name: String, missing: String },
#[error("step is not a mapping")]
StepNotMapping,
diff --git a/src/map.rs b/src/map.rs
index 874e537..e6a24a9 100644
--- a/src/map.rs
+++ b/src/map.rs
@@ -135,10 +135,7 @@ impl Roadmap {
1 => (),
_ => {
let names: Vec<String> = goals.iter().map(|s| s.name().into()).collect();
- return Err(RoadmapError::ManyGoals {
- count: n,
- names,
- });
+ return Err(RoadmapError::ManyGoals { count: n, names });
}
}
@@ -146,11 +143,12 @@ impl Roadmap {
for step in self.iter() {
for depname in step.dependencies() {
match self.get_step(depname) {
- None =>
+ None => {
return Err(RoadmapError::MissingDep {
name: step.name().into(),
missing: depname.into(),
- }),
+ })
+ }
Some(_) => (),
}
}
diff --git a/src/parser.rs b/src/parser.rs
index d83f618..6cc3d25 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -46,7 +46,7 @@ fn parse_depends(map: &Value) -> RoadmapResult<Vec<&str>> {
let key_name = "depends";
let key = Value::String(key_name.to_string());
let mut depends: Vec<&str> = vec![];
-
+
match map.get(&key) {
None => (),
Some(Value::Sequence(deps)) => {