mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
make task.$T.priority optional
default the value to 1 if omitted
This commit is contained in:
parent
aa22494549
commit
b37c45ad2a
1 changed files with 8 additions and 20 deletions
|
@ -31,16 +31,8 @@ pub fn app(app: check::App) -> Result<App> {
|
||||||
resources: app.resources,
|
resources: app.resources,
|
||||||
tasks: app.tasks
|
tasks: app.tasks
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(k, v)| {
|
.map(|(k, v)| (k, ::check::task(v)))
|
||||||
let name = k.clone();
|
.collect(),
|
||||||
Ok((
|
|
||||||
k,
|
|
||||||
::check::task(v)
|
|
||||||
.chain_err(|| format!("checking task `{}`", name))?,
|
|
||||||
))
|
|
||||||
})
|
|
||||||
.collect::<Result<_>>()
|
|
||||||
.chain_err(|| "checking `tasks`")?,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
::check::resources(&app)
|
::check::resources(&app)
|
||||||
|
@ -68,15 +60,11 @@ fn resources(app: &App) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn task(task: syntax::check::Task) -> Result<Task> {
|
fn task(task: syntax::check::Task) -> Task {
|
||||||
if let Some(priority) = task.priority {
|
Task {
|
||||||
Ok(Task {
|
|
||||||
enabled: task.enabled,
|
enabled: task.enabled,
|
||||||
path: task.path,
|
path: task.path,
|
||||||
priority,
|
priority: task.priority.unwrap_or(1),
|
||||||
resources: task.resources,
|
resources: task.resources,
|
||||||
})
|
|
||||||
} else {
|
|
||||||
bail!("should contain a `priority` field")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue