Skip to content

Commit

Permalink
Remove result for incorporate_new_op
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffa5 committed Jun 17, 2021
1 parent 80ee73a commit 14269e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions automerge-backend/src/concurrent_operations.rs
@@ -1,6 +1,6 @@
use std::ops::Deref;

use crate::{error::AutomergeError, internal::InternalOpType, op_handle::OpHandle};
use crate::{internal::InternalOpType, op_handle::OpHandle};

/// Represents a set of operations which are relevant to either an element ID
/// or object ID and which occurred without knowledge of each other
Expand Down Expand Up @@ -38,17 +38,14 @@ impl ConcurrentOperations {
/// replaces.
/// This is to cover the case of increment operations actually being reflected as Sets on
/// counters.
pub fn incorporate_new_op(
&mut self,
new_op: OpHandle,
) -> Result<(OpHandle, Vec<OpHandle>), AutomergeError> {
pub fn incorporate_new_op(&mut self, new_op: OpHandle) -> (OpHandle, Vec<OpHandle>) {
if new_op.is_inc() {
for op in &mut self.ops {
if op.maybe_increment(&new_op) {
return Ok((op.clone(), Vec::new()));
return (op.clone(), Vec::new());
}
}
Ok((new_op, Vec::new()))
(new_op, Vec::new())
} else {
let mut overwritten_ops = Vec::new();
let mut i = 0;
Expand All @@ -67,7 +64,7 @@ impl ConcurrentOperations {
_ => {}
}

Ok((new_op, overwritten_ops))
(new_op, overwritten_ops)
}
}
}
4 changes: 2 additions & 2 deletions automerge-backend/src/op_set.rs
Expand Up @@ -137,7 +137,7 @@ impl OpSet {
.entry(op.operation_key().into_owned())
.or_default();
let before = !ops.is_empty();
let (op, overwritten_ops) = ops.incorporate_new_op(op)?;
let (op, overwritten_ops) = ops.incorporate_new_op(op);
let after = !ops.is_empty();

match (before, after) {
Expand Down Expand Up @@ -180,7 +180,7 @@ impl OpSet {
} else {
let ops = object.props.entry(op.key.clone()).or_default();
let before = !ops.is_empty();
let (op, overwritten_ops) = ops.incorporate_new_op(op)?;
let (op, overwritten_ops) = ops.incorporate_new_op(op);
let after = !ops.is_empty();
self.unlink(&op, &overwritten_ops)?;

Expand Down

0 comments on commit 14269e1

Please sign in to comment.