Diffstat (limited to 'tests/protocol_visitor_sequence.rs')
| -rw-r--r-- | tests/protocol_visitor_sequence.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/protocol_visitor_sequence.rs b/tests/protocol_visitor_sequence.rs index 732e090..bc29ea4 100644 --- a/tests/protocol_visitor_sequence.rs +++ b/tests/protocol_visitor_sequence.rs @@ -1,6 +1,6 @@ use std::any::TypeId; -use common::protocol::sequence::{MockSequenceScope, MockSequenceVisitor, SequenceScopeFactory}; +use common::protocol::sequence::{MockSequenceScope, MockSequenceVisitor}; use treaty::{ any::{OwnedStatic, TypeNameId}, effect::blocking::Blocking, @@ -20,23 +20,21 @@ fn sequence_has_scope_with_size_hint_and_next() { let mut mock = MockSequenceVisitor::<Blocking>::new(); // Expect a visit with the sequence protocol. - mock.expect_visit().once().return_const( - (|(), scope| { - // Get the size hint from the sequence scope. - assert_eq!(scope.size_hint().value(), (1, Some(1))); + mock.expect_visit().once().returning(|scope| { + // Get the size hint from the sequence scope. + assert_eq!(scope.size_hint().value(), (1, Some(1))); - let mut visitor = MockBuilder::<(), (), ()>::new(); + let mut visitor = MockBuilder::<(), (), ()>::new(); - // Expect the walker to lookup a trait. - visitor.expect_traits().once().return_const(None); + // Expect the walker to lookup a trait. + visitor.expect_traits().once().return_const(None); - // Get the next item in the sequence from the walker. - assert_eq!(scope.next(DynVisitor(&mut visitor)).value(), Flow::Done); + // Get the next item in the sequence from the walker. + assert_eq!(scope.next(DynVisitor(&mut visitor)).value(), Flow::Done); - // We are done. - VisitResult::Control(Flow::Done) - }) as SequenceScopeFactory<Blocking>, - ); + // We are done. + VisitResult::Control(Flow::Done) + }); // Everything goes throw the sequence protocol trait. let visitor: &mut dyn Sequence<Blocking> = &mut mock; |