From 6d77b9a319a2aadadb6d5df944330769a7cca87b Mon Sep 17 00:00:00 2001 From: dbr Date: Thu, 25 Mar 2021 17:10:11 +1100 Subject: [PATCH] cargo fmt --- cli/src/argparse/command.rs | 5 +---- cli/src/report.rs | 10 +++++++--- taskchampion/src/server/local.rs | 5 ++++- taskchampion/src/server/remote/crypto.rs | 4 +++- taskchampion/src/server/remote/mod.rs | 5 ++++- taskchampion/src/server/test.rs | 5 ++++- taskchampion/src/server/types.rs | 5 ++++- taskchampion/src/task.rs | 12 ++++++++++-- taskchampion/src/taskdb.rs | 10 ++++++---- 9 files changed, 43 insertions(+), 18 deletions(-) diff --git a/cli/src/argparse/command.rs b/cli/src/argparse/command.rs index 198a0abf5..f9c71352c 100644 --- a/cli/src/argparse/command.rs +++ b/cli/src/argparse/command.rs @@ -32,10 +32,7 @@ impl Command { pub fn from_argv(argv: &[&str]) -> anyhow::Result { 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), diff --git a/cli/src/report.rs b/cli/src/report.rs index 8670281f3..e2cdddac4 100644 --- a/cli/src/report.rs +++ b/cli/src/report.rs @@ -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::>>()? } 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::>>()?; let conditions = if let Some(conditions) = map.remove("filter") { diff --git a/taskchampion/src/server/local.rs b/taskchampion/src/server/local.rs index f24ee96f6..84ee18fa8 100644 --- a/taskchampion/src/server/local.rs +++ b/taskchampion/src/server/local.rs @@ -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 { + fn get_child_version( + &mut self, + parent_version_id: VersionId, + ) -> anyhow::Result { if let Some(version) = self.get_version_by_parent_version_id(parent_version_id)? { Ok(GetVersionResult::Version { version_id: version.version_id, diff --git a/taskchampion/src/server/remote/crypto.rs b/taskchampion/src/server/remote/crypto.rs index 3751d606f..a236ef7be 100644 --- a/taskchampion/src/server/remote/crypto.rs +++ b/taskchampion/src/server/remote/crypto.rs @@ -62,7 +62,9 @@ impl TryFrom 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" + )) } } } diff --git a/taskchampion/src/server/remote/mod.rs b/taskchampion/src/server/remote/mod.rs index ed88d4b15..29ee216f1 100644 --- a/taskchampion/src/server/remote/mod.rs +++ b/taskchampion/src/server/remote/mod.rs @@ -83,7 +83,10 @@ impl Server for RemoteServer { } } - fn get_child_version(&mut self, parent_version_id: VersionId) -> anyhow::Result { + fn get_child_version( + &mut self, + parent_version_id: VersionId, + ) -> anyhow::Result { let url = format!( "{}/client/get-child-version/{}", self.origin, parent_version_id diff --git a/taskchampion/src/server/test.rs b/taskchampion/src/server/test.rs index b8e439b47..798a54c1e 100644 --- a/taskchampion/src/server/test.rs +++ b/taskchampion/src/server/test.rs @@ -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 { + fn get_child_version( + &mut self, + parent_version_id: VersionId, + ) -> anyhow::Result { if let Some(version) = self.versions.get(&parent_version_id) { Ok(GetVersionResult::Version { version_id: version.version_id, diff --git a/taskchampion/src/server/types.rs b/taskchampion/src/server/types.rs index 4478934d5..466e286a5 100644 --- a/taskchampion/src/server/types.rs +++ b/taskchampion/src/server/types.rs @@ -43,5 +43,8 @@ pub trait Server { ) -> anyhow::Result; /// Get the version with the given parent VersionId - fn get_child_version(&mut self, parent_version_id: VersionId) -> anyhow::Result; + fn get_child_version( + &mut self, + parent_version_id: VersionId, + ) -> anyhow::Result; } diff --git a/taskchampion/src/task.rs b/taskchampion/src/task.rs index afc7fc253..07bb19909 100644 --- a/taskchampion/src/task.rs +++ b/taskchampion/src/task.rs @@ -330,7 +330,11 @@ impl<'r> TaskMut<'r> { Ok(()) } - fn set_string>(&mut self, property: S, value: Option) -> anyhow::Result<()> { + fn set_string>( + &mut self, + property: S, + value: Option, + ) -> 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>) -> anyhow::Result<()> { + fn set_timestamp( + &mut self, + property: &str, + value: Option>, + ) -> anyhow::Result<()> { self.lastmod()?; if let Some(value) = value { let ts = format!("{}", value.timestamp()); diff --git a/taskchampion/src/taskdb.rs b/taskchampion/src/taskdb.rs index 7bee3b741..ed728b8e6 100644 --- a/taskchampion/src/taskdb.rs +++ b/taskchampion/src/taskdb.rs @@ -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(&mut self, in_working_set: F, renumber: bool) -> anyhow::Result<()> + pub fn rebuild_working_set( + &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);