aboutsummaryrefslogtreecommitdiff
path: root/macros/src/check.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-27 12:11:22 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-27 12:11:22 -0500
commitb37c45ad2a295f067b6cacf9424ff9f68674f82b (patch)
tree7de905962acb487205ef22713cf2aff7f4dd514d /macros/src/check.rs
parentaa2249454975a203e459597005944f5370c1d200 (diff)
downloadrtic-b37c45ad2a295f067b6cacf9424ff9f68674f82b.tar.gz
rtic-b37c45ad2a295f067b6cacf9424ff9f68674f82b.tar.zst
rtic-b37c45ad2a295f067b6cacf9424ff9f68674f82b.zip
make task.$T.priority optional
default the value to 1 if omitted
Diffstat (limited to 'macros/src/check.rs')
-rw-r--r--macros/src/check.rs28
1 files changed, 8 insertions, 20 deletions
diff --git a/macros/src/check.rs b/macros/src/check.rs
index cedf9336..571f2351 100644
--- a/macros/src/check.rs
+++ b/macros/src/check.rs
@@ -31,16 +31,8 @@ pub fn app(app: check::App) -> Result<App> {
resources: app.resources,
tasks: app.tasks
.into_iter()
- .map(|(k, v)| {
- let name = k.clone();
- Ok((
- k,
- ::check::task(v)
- .chain_err(|| format!("checking task `{}`", name))?,
- ))
- })
- .collect::<Result<_>>()
- .chain_err(|| "checking `tasks`")?,
+ .map(|(k, v)| (k, ::check::task(v)))
+ .collect(),
};
::check::resources(&app)
@@ -68,15 +60,11 @@ fn resources(app: &App) -> Result<()> {
Ok(())
}
-fn task(task: syntax::check::Task) -> Result<Task> {
- if let Some(priority) = task.priority {
- Ok(Task {
- enabled: task.enabled,
- path: task.path,
- priority,
- resources: task.resources,
- })
- } else {
- bail!("should contain a `priority` field")
+fn task(task: syntax::check::Task) -> Task {
+ Task {
+ enabled: task.enabled,
+ path: task.path,
+ priority: task.priority.unwrap_or(1),
+ resources: task.resources,
}
}