cargo fmt
This commit is contained in:
@@ -162,10 +162,22 @@ fn named_date<Tz: TimeZone>(
|
||||
// TODO: lots more!
|
||||
"eod" => Ok((remaining, local_today + Duration::days(1))),
|
||||
"sod" => Ok((remaining, local_today)),
|
||||
"eow" => Ok((remaining,local_today + Duration::days((6-day_index).into()))),
|
||||
"eoww" => Ok((remaining,local_today + Duration::days((5-day_index).into()))),
|
||||
"sow" => Ok((remaining,local_today + Duration::days((6-day_index).into()))),
|
||||
"soww" => Ok((remaining,local_today + Duration::days((7-day_index).into()))),
|
||||
"eow" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((6 - day_index).into()),
|
||||
)),
|
||||
"eoww" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((5 - day_index).into()),
|
||||
)),
|
||||
"sow" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((6 - day_index).into()),
|
||||
)),
|
||||
"soww" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((7 - day_index).into()),
|
||||
)),
|
||||
_ => Err(Err::Error(Error::new(input, ErrorKind::Tag))),
|
||||
}
|
||||
.map(|(rem, dt)| (rem, dt.and_hms(0, 0, 0).with_timezone(&Utc)))
|
||||
|
||||
@@ -113,9 +113,11 @@ impl<'t> Txn<'t> {
|
||||
fn get_next_working_set_number(&self) -> anyhow::Result<usize> {
|
||||
let t = self.get_txn()?;
|
||||
let next_id: Option<usize> = t
|
||||
.query_row("SELECT COALESCE(MAX(id), 0) + 1 FROM working_set", [], |r| {
|
||||
r.get(0)
|
||||
})
|
||||
.query_row(
|
||||
"SELECT COALESCE(MAX(id), 0) + 1 FROM working_set",
|
||||
[],
|
||||
|r| r.get(0),
|
||||
)
|
||||
.optional()
|
||||
.context("Getting highest working set ID")?;
|
||||
|
||||
@@ -290,7 +292,10 @@ impl<'t> StorageTxn for Txn<'t> {
|
||||
|
||||
let rows: Vec<Result<(usize, Uuid), _>> = rows.collect();
|
||||
let mut res = Vec::with_capacity(rows.len());
|
||||
for _ in 0..self.get_next_working_set_number().context("Getting working set number")? {
|
||||
for _ in 0..self
|
||||
.get_next_working_set_number()
|
||||
.context("Getting working set number")?
|
||||
{
|
||||
res.push(None);
|
||||
}
|
||||
for r in rows {
|
||||
|
||||
Reference in New Issue
Block a user