summaryrefslogtreecommitdiffstats
path: root/src/static_api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/static_api.rs')
-rw-r--r--src/static_api.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/static_api.rs b/src/static_api.rs
index 164cfbe..33bac41 100644
--- a/src/static_api.rs
+++ b/src/static_api.rs
@@ -1,9 +1,9 @@
use crate::data::Data;
-use rust_team_data::v1;
use failure::Error;
+use indexmap::IndexMap;
use log::info;
+use rust_team_data::v1;
use std::path::Path;
-use indexmap::IndexMap;
pub(crate) struct Generator<'a> {
dest: &'a Path,
@@ -56,7 +56,7 @@ impl<'a> Generator<'a> {
website_data: team.website_data().map(|ws| v1::TeamWebsite {
name: ws.name().into(),
description: ws.description().into(),
- page: ws.page().unwrap_or(team.name()).into(),
+ page: ws.page().unwrap_or_else(|| team.name()).into(),
email: ws.email().map(|e| e.into()),
repo: ws.repo().map(|e| e.into()),
discord: ws.discord().map(|i| v1::DiscordInvite {
@@ -72,10 +72,7 @@ impl<'a> Generator<'a> {
}
teams.sort_keys();
- self.add(
- "v1/teams.json",
- &v1::Teams { teams },
- )?;
+ self.add("v1/teams.json", &v1::Teams { teams })?;
Ok(())
}
@@ -85,17 +82,17 @@ impl<'a> Generator<'a> {
for list in self.data.lists()?.values() {
let mut members = list.emails().to_vec();
members.sort();
- lists.insert(list.address().to_string(), v1::List {
- address: list.address().to_string(),
- members,
- });
+ lists.insert(
+ list.address().to_string(),
+ v1::List {
+ address: list.address().to_string(),
+ members,
+ },
+ );
}
lists.sort_keys();
- self.add(
- "v1/lists.json",
- &v1::Lists { lists },
- )?;
+ self.add("v1/lists.json", &v1::Lists { lists })?;
Ok(())
}