mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-24 08:56:43 +02:00
cargo fmt
This commit is contained in:
parent
0e7a4c2c33
commit
6d77b9a319
9 changed files with 43 additions and 18 deletions
|
@ -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