Refactor using `NonEmpty::try_map`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
f90f714fcf
commit
909b99bb7c
|
|
@ -396,7 +396,7 @@ impl<'a> Issues<'a> {
|
|||
tx.tag(tags.to_owned(), []);
|
||||
})?;
|
||||
// Just a sanity check that our clock is advancing as expected.
|
||||
assert_eq!(clock.get(), 2);
|
||||
debug_assert_eq!(clock.get(), 2);
|
||||
|
||||
Ok(IssueMut {
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -769,7 +769,7 @@ impl<'a> Patches<'a> {
|
|||
tx.tag(tags.to_owned(), []);
|
||||
})?;
|
||||
// Just a sanity check that our clock is advancing as expected.
|
||||
assert_eq!(clock.get(), 2);
|
||||
debug_assert_eq!(clock.get(), 2);
|
||||
|
||||
Ok(PatchMut::new(id, patch, clock, self))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,13 +104,7 @@ where
|
|||
actions: impl Into<NonEmpty<T::Action>>,
|
||||
signer: &G,
|
||||
) -> Result<CollaborativeObject, Error> {
|
||||
let changes = actions
|
||||
.into()
|
||||
.iter()
|
||||
.map(encoding::encode)
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
.try_into()
|
||||
.expect("the collection is always non-empty");
|
||||
let changes = actions.into().try_map(|e| encoding::encode(&e))?;
|
||||
|
||||
cob::update(
|
||||
self.raw,
|
||||
|
|
@ -135,13 +129,7 @@ where
|
|||
actions: impl Into<NonEmpty<T::Action>>,
|
||||
signer: &G,
|
||||
) -> Result<(ObjectId, T, Lamport), Error> {
|
||||
let contents = actions
|
||||
.into()
|
||||
.iter()
|
||||
.map(encoding::encode)
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
.try_into()
|
||||
.expect("the collection is always non-empty");
|
||||
let contents = actions.into().try_map(|e| encoding::encode(&e))?;
|
||||
let cob = cob::create(
|
||||
self.raw,
|
||||
signer,
|
||||
|
|
|
|||
Loading…
Reference in New Issue