mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
cargo fmt
This commit is contained in:
parent
0e7a4c2c33
commit
6d77b9a319
9 changed files with 43 additions and 18 deletions
|
@ -32,10 +32,7 @@ impl Command {
|
|||
pub fn from_argv(argv: &[&str]) -> anyhow::Result<Command> {
|
||||
match Command::parse(argv) {
|
||||
Ok((&[], cmd)) => Ok(cmd),
|
||||
Ok((trailing, _)) => bail!(
|
||||
"command line has trailing arguments: {:?}",
|
||||
trailing
|
||||
),
|
||||
Ok((trailing, _)) => bail!("command line has trailing arguments: {:?}", trailing),
|
||||
Err(Err::Incomplete(_)) => unreachable!(),
|
||||
Err(Err::Error(e)) => bail!("command line not recognized: {:?}", e),
|
||||
Err(Err::Failure(e)) => bail!("command line not recognized: {:?}", e),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! This module contains the data structures used to define reports.
|
||||
|
||||
use crate::argparse::{Condition, Filter};
|
||||
use anyhow::{bail};
|
||||
use anyhow::bail;
|
||||
|
||||
/// A report specifies a filter as well as a sort order and information about which
|
||||
/// task attributes to display
|
||||
|
@ -85,7 +85,9 @@ impl Report {
|
|||
.map_err(|e| anyhow::anyhow!(".sort: {}", e))?
|
||||
.drain(..)
|
||||
.enumerate()
|
||||
.map(|(i, v)| Sort::from_config(v).map_err(|e| anyhow::anyhow!(".sort[{}]{}", i, e)))
|
||||
.map(|(i, v)| {
|
||||
Sort::from_config(v).map_err(|e| anyhow::anyhow!(".sort[{}]{}", i, e))
|
||||
})
|
||||
.collect::<anyhow::Result<Vec<_>>>()?
|
||||
} else {
|
||||
vec![]
|
||||
|
@ -98,7 +100,9 @@ impl Report {
|
|||
.map_err(|e| anyhow::anyhow!(".columns: {}", e))?
|
||||
.drain(..)
|
||||
.enumerate()
|
||||
.map(|(i, v)| Column::from_config(v).map_err(|e| anyhow::anyhow!(".columns[{}]{}", i, e)))
|
||||
.map(|(i, v)| {
|
||||
Column::from_config(v).map_err(|e| anyhow::anyhow!(".columns[{}]{}", i, e))
|
||||
})
|
||||
.collect::<anyhow::Result<Vec<_>>>()?;
|
||||
|
||||
let conditions = if let Some(conditions) = map.remove("filter") {
|
||||
|
|
|
@ -132,7 +132,10 @@ impl<'t> Server for LocalServer<'t> {
|
|||
}
|
||||
|
||||
/// Get a vector of all versions after `since_version`
|
||||
fn get_child_version(&mut self, parent_version_id: VersionId) -> anyhow::Result<GetVersionResult> {
|
||||
fn get_child_version(
|
||||
&mut self,
|
||||
parent_version_id: VersionId,
|
||||
) -> anyhow::Result<GetVersionResult> {
|
||||
if let Some(version) = self.get_version_by_parent_version_id(parent_version_id)? {
|
||||
Ok(GetVersionResult::Version {
|
||||
version_id: version.version_id,
|
||||
|
|
|
@ -62,7 +62,9 @@ impl TryFrom<ureq::Response> for HistoryCiphertext {
|
|||
reader.read_to_end(&mut bytes)?;
|
||||
Ok(Self(bytes))
|
||||
} else {
|
||||
Err(anyhow::anyhow!("Response did not have expected content-type"))
|
||||
Err(anyhow::anyhow!(
|
||||
"Response did not have expected content-type"
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,10 @@ impl Server for RemoteServer {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_child_version(&mut self, parent_version_id: VersionId) -> anyhow::Result<GetVersionResult> {
|
||||
fn get_child_version(
|
||||
&mut self,
|
||||
parent_version_id: VersionId,
|
||||
) -> anyhow::Result<GetVersionResult> {
|
||||
let url = format!(
|
||||
"{}/client/get-child-version/{}",
|
||||
self.origin, parent_version_id
|
||||
|
|
|
@ -63,7 +63,10 @@ impl Server for TestServer {
|
|||
}
|
||||
|
||||
/// Get a vector of all versions after `since_version`
|
||||
fn get_child_version(&mut self, parent_version_id: VersionId) -> anyhow::Result<GetVersionResult> {
|
||||
fn get_child_version(
|
||||
&mut self,
|
||||
parent_version_id: VersionId,
|
||||
) -> anyhow::Result<GetVersionResult> {
|
||||
if let Some(version) = self.versions.get(&parent_version_id) {
|
||||
Ok(GetVersionResult::Version {
|
||||
version_id: version.version_id,
|
||||
|
|
|
@ -43,5 +43,8 @@ pub trait Server {
|
|||
) -> anyhow::Result<AddVersionResult>;
|
||||
|
||||
/// Get the version with the given parent VersionId
|
||||
fn get_child_version(&mut self, parent_version_id: VersionId) -> anyhow::Result<GetVersionResult>;
|
||||
fn get_child_version(
|
||||
&mut self,
|
||||
parent_version_id: VersionId,
|
||||
) -> anyhow::Result<GetVersionResult>;
|
||||
}
|
||||
|
|
|
@ -330,7 +330,11 @@ impl<'r> TaskMut<'r> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_string<S: Into<String>>(&mut self, property: S, value: Option<String>) -> anyhow::Result<()> {
|
||||
fn set_string<S: Into<String>>(
|
||||
&mut self,
|
||||
property: S,
|
||||
value: Option<String>,
|
||||
) -> anyhow::Result<()> {
|
||||
let property = property.into();
|
||||
self.lastmod()?;
|
||||
self.replica
|
||||
|
@ -346,7 +350,11 @@ impl<'r> TaskMut<'r> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_timestamp(&mut self, property: &str, value: Option<DateTime<Utc>>) -> anyhow::Result<()> {
|
||||
fn set_timestamp(
|
||||
&mut self,
|
||||
property: &str,
|
||||
value: Option<DateTime<Utc>>,
|
||||
) -> anyhow::Result<()> {
|
||||
self.lastmod()?;
|
||||
if let Some(value) = value {
|
||||
let ts = format!("{}", value.timestamp());
|
||||
|
|
|
@ -107,7 +107,11 @@ impl TaskDB {
|
|||
/// renumbers the existing working-set tasks to eliminate gaps, and also adds any tasks that
|
||||
/// are not already in the working set but should be. The rebuild occurs in a single
|
||||
/// trasnsaction against the storage backend.
|
||||
pub fn rebuild_working_set<F>(&mut self, in_working_set: F, renumber: bool) -> anyhow::Result<()>
|
||||
pub fn rebuild_working_set<F>(
|
||||
&mut self,
|
||||
in_working_set: F,
|
||||
renumber: bool,
|
||||
) -> anyhow::Result<()>
|
||||
where
|
||||
F: Fn(&TaskMap) -> bool,
|
||||
{
|
||||
|
@ -246,9 +250,7 @@ impl TaskDB {
|
|||
);
|
||||
if let Some(requested) = requested_parent_version_id {
|
||||
if parent_version_id == requested {
|
||||
anyhow::bail!(
|
||||
"Server's task history has diverged from this replica"
|
||||
);
|
||||
anyhow::bail!("Server's task history has diverged from this replica");
|
||||
}
|
||||
}
|
||||
requested_parent_version_id = Some(parent_version_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue