@@ -307,8 +307,6 @@ fn reached_target(target: WordMotionTarget, prev_ch: char, next_ch: char) -> boo
308#[cfg(test)]
308#[cfg(test)]
309mod test {
309mod test {
310− use std::array::{self, IntoIter};
312 use ropey::Rope;
310 use ropey::Rope;
314 use super::*;
312 use super::*;
@@ -360,7 +358,7 @@ mod test {
360 ((Direction::Backward, 999usize), (0, 0)), // |This is a simple alphabetic line
358 ((Direction::Backward, 999usize), (0, 0)), // |This is a simple alphabetic line
363− for ((direction, amount), coordinates) in IntoIter::new(moves_and_expected_coordinates) {
361+ for ((direction, amount), coordinates) in moves_and_expected_coordinates {
364 range = move_horizontally(slice, range, direction, amount, Movement::Move);
362 range = move_horizontally(slice, range, direction, amount, Movement::Move);
365 assert_eq!(coords_at_pos(slice, range.head), coordinates.into())
363 assert_eq!(coords_at_pos(slice, range.head), coordinates.into())
@@ -374,7 +372,7 @@ mod test {
375 let mut range = Range::point(position);
373 let mut range = Range::point(position);
377− let moves_and_expected_coordinates = IntoIter::new([
375+ let moves_and_expected_coordinates = [
378 ((Direction::Forward, 11usize), (1, 1)), // Multiline\nt|ext sample\n...
376 ((Direction::Forward, 11usize), (1, 1)), // Multiline\nt|ext sample\n...
379 ((Direction::Backward, 1usize), (1, 0)), // Multiline\n|text sample\n...
377 ((Direction::Backward, 1usize), (1, 0)), // Multiline\n|text sample\n...
380 ((Direction::Backward, 5usize), (0, 5)), // Multi|line\ntext sample\n...
378 ((Direction::Backward, 5usize), (0, 5)), // Multi|line\ntext sample\n...
@@ -384,7 +382,7 @@ mod test {
384 ((Direction::Backward, 0usize), (0, 3)), // Mul|tiline\ntext sample\n...
382 ((Direction::Backward, 0usize), (0, 3)), // Mul|tiline\ntext sample\n...
385 ((Direction::Forward, 999usize), (5, 0)), // ...and whitespaced\n|
383 ((Direction::Forward, 999usize), (5, 0)), // ...and whitespaced\n|
386 ((Direction::Forward, 999usize), (5, 0)), // ...and whitespaced\n|
384 ((Direction::Forward, 999usize), (5, 0)), // ...and whitespaced\n|
389 for ((direction, amount), coordinates) in moves_and_expected_coordinates {
387 for ((direction, amount), coordinates) in moves_and_expected_coordinates {
390 range = move_horizontally(slice, range, direction, amount, Movement::Move);
388 range = move_horizontally(slice, range, direction, amount, Movement::Move);
@@ -402,11 +400,11 @@ mod test {
402 let mut range = Range::point(position);
400 let mut range = Range::point(position);
403 let original_anchor = range.anchor;
401 let original_anchor = range.anchor;
405− let moves = IntoIter::new([
403+ let moves = [
406 (Direction::Forward, 1usize),
404 (Direction::Forward, 1usize),
407 (Direction::Forward, 5usize),
405 (Direction::Forward, 5usize),
408 (Direction::Backward, 3usize),
406 (Direction::Backward, 3usize),
411 for (direction, amount) in moves {
409 for (direction, amount) in moves {
412 range = move_horizontally(slice, range, direction, amount, Movement::Extend);
410 range = move_horizontally(slice, range, direction, amount, Movement::Extend);
@@ -420,7 +418,7 @@ mod test {
420 let slice = text.slice(..);
418 let slice = text.slice(..);
421 let position = pos_at_coords(slice, (0, 0).into(), true);
419 let position = pos_at_coords(slice, (0, 0).into(), true);
422 let mut range = Range::point(position);
420 let mut range = Range::point(position);
423− let moves_and_expected_coordinates = IntoIter::new([
421+ let moves_and_expected_coordinates = [
424 ((Direction::Forward, 1usize), (1, 0)),
422 ((Direction::Forward, 1usize), (1, 0)),
425 ((Direction::Forward, 2usize), (3, 0)),
423 ((Direction::Forward, 2usize), (3, 0)),
426 ((Direction::Forward, 1usize), (4, 0)),
424 ((Direction::Forward, 1usize), (4, 0)),
@@ -430,7 +428,7 @@ mod test {
430 ((Direction::Backward, 0usize), (4, 0)),
428 ((Direction::Backward, 0usize), (4, 0)),
431 ((Direction::Forward, 5), (5, 0)),
429 ((Direction::Forward, 5), (5, 0)),
432 ((Direction::Forward, 999usize), (5, 0)),
430 ((Direction::Forward, 999usize), (5, 0)),
435 for ((direction, amount), coordinates) in moves_and_expected_coordinates {
433 for ((direction, amount), coordinates) in moves_and_expected_coordinates {
436 range = move_vertically(slice, range, direction, amount, Movement::Move);
434 range = move_vertically(slice, range, direction, amount, Movement::Move);
@@ -450,7 +448,7 @@ mod test {
453− let moves_and_expected_coordinates = IntoIter::new([
451+ let moves_and_expected_coordinates = [
454 // Places cursor at the end of line
452 // Places cursor at the end of line
455 ((Axis::H, Direction::Forward, 8usize), (0, 8)),
453 ((Axis::H, Direction::Forward, 8usize), (0, 8)),
456 // First descent preserves column as the target line is wider
454 // First descent preserves column as the target line is wider
@@ -463,7 +461,7 @@ mod test {
463 ((Axis::V, Direction::Backward, 999usize), (0, 8)),
461 ((Axis::V, Direction::Backward, 999usize), (0, 8)),
464 ((Axis::V, Direction::Forward, 4usize), (4, 8)),
462 ((Axis::V, Direction::Forward, 4usize), (4, 8)),
465 ((Axis::V, Direction::Forward, 999usize), (5, 0)),
463 ((Axis::V, Direction::Forward, 999usize), (5, 0)),
468 for ((axis, direction, amount), coordinates) in moves_and_expected_coordinates {
466 for ((axis, direction, amount), coordinates) in moves_and_expected_coordinates {
469 range = match axis {
467 range = match axis {
@@ -489,7 +487,7 @@ mod test {
492− let moves_and_expected_coordinates = IntoIter::new([
490+ let moves_and_expected_coordinates = [
493 // Places cursor at the fourth kana.
491 // Places cursor at the fourth kana.
494 ((Axis::H, Direction::Forward, 4), (0, 4)),
492 ((Axis::H, Direction::Forward, 4), (0, 4)),
495 // Descent places cursor at the 4th character.
493 // Descent places cursor at the 4th character.
@@ -498,7 +496,7 @@ mod test {
498 ((Axis::H, Direction::Backward, 1usize), (1, 3)),
496 ((Axis::H, Direction::Backward, 1usize), (1, 3)),
499 // Jumping back up 1 line.
497 // Jumping back up 1 line.
500 ((Axis::V, Direction::Backward, 1usize), (0, 3)),
498 ((Axis::V, Direction::Backward, 1usize), (0, 3)),
503 for ((axis, direction, amount), coordinates) in moves_and_expected_coordinates {
501 for ((axis, direction, amount), coordinates) in moves_and_expected_coordinates {
504 range = match axis {
502 range = match axis {
@@ -530,7 +528,7 @@ mod test {
532 fn test_behaviour_when_moving_to_start_of_next_words() {
530 fn test_behaviour_when_moving_to_start_of_next_words() {
533− let tests = array::IntoIter::new([
531+ let tests = [
534 ("Basic forward motion stops at the first space",
532 ("Basic forward motion stops at the first space",
535 vec![(1, Range::new(0, 0), Range::new(0, 6))]),
533 vec![(1, Range::new(0, 0), Range::new(0, 6))]),
536 (" Starting from a boundary advances the anchor",
534 (" Starting from a boundary advances the anchor",
@@ -604,7 +602,7 @@ mod test {
605 (1, Range::new(0, 0), Range::new(0, 6)),
603 (1, Range::new(0, 0), Range::new(0, 6)),
609 for (sample, scenario) in tests {
607 for (sample, scenario) in tests {
610 for (count, begin, expected_end) in scenario.into_iter() {
608 for (count, begin, expected_end) in scenario.into_iter() {
@@ -616,7 +614,7 @@ mod test {
618 fn test_behaviour_when_moving_to_start_of_next_long_words() {
616 fn test_behaviour_when_moving_to_start_of_next_long_words() {
619− let tests = array::IntoIter::new([
617+ let tests = [
620 ("Basic forward motion stops at the first space",
618 ("Basic forward motion stops at the first space",
621 vec![(1, Range::new(0, 0), Range::new(0, 6))]),
619 vec![(1, Range::new(0, 0), Range::new(0, 6))]),
622 (" Starting from a boundary advances the anchor",
620 (" Starting from a boundary advances the anchor",
@@ -688,7 +686,7 @@ mod test {
689 (1, Range::new(0, 0), Range::new(0, 8)),
687 (1, Range::new(0, 0), Range::new(0, 8)),
693 for (sample, scenario) in tests {
691 for (sample, scenario) in tests {
694 for (count, begin, expected_end) in scenario.into_iter() {
692 for (count, begin, expected_end) in scenario.into_iter() {
@@ -700,7 +698,7 @@ mod test {
702 fn test_behaviour_when_moving_to_start_of_previous_words() {
700 fn test_behaviour_when_moving_to_start_of_previous_words() {
703− let tests = array::IntoIter::new([
701+ let tests = [
704 ("Basic backward motion from the middle of a word",
702 ("Basic backward motion from the middle of a word",
705 vec![(1, Range::new(3, 3), Range::new(4, 0))]),
703 vec![(1, Range::new(3, 3), Range::new(4, 0))]),
@@ -773,7 +771,7 @@ mod test {
774 (1, Range::new(0, 6), Range::new(6, 0)),
772 (1, Range::new(0, 6), Range::new(6, 0)),
778 for (sample, scenario) in tests {
776 for (sample, scenario) in tests {
779 for (count, begin, expected_end) in scenario.into_iter() {
777 for (count, begin, expected_end) in scenario.into_iter() {
@@ -785,7 +783,7 @@ mod test {
787 fn test_behaviour_when_moving_to_start_of_previous_long_words() {
785 fn test_behaviour_when_moving_to_start_of_previous_long_words() {
788− let tests = array::IntoIter::new([
786+ let tests = [
790 "Basic backward motion from the middle of a word",
788 "Basic backward motion from the middle of a word",
791 vec![(1, Range::new(3, 3), Range::new(4, 0))],
789 vec![(1, Range::new(3, 3), Range::new(4, 0))],
@@ -870,7 +868,7 @@ mod test {
871 (1, Range::new(0, 8), Range::new(8, 0)),
869 (1, Range::new(0, 8), Range::new(8, 0)),
875 for (sample, scenario) in tests {
873 for (sample, scenario) in tests {
876 for (count, begin, expected_end) in scenario.into_iter() {
874 for (count, begin, expected_end) in scenario.into_iter() {
@@ -882,7 +880,7 @@ mod test {
884 fn test_behaviour_when_moving_to_end_of_next_words() {
882 fn test_behaviour_when_moving_to_end_of_next_words() {
885− let tests = array::IntoIter::new([
883+ let tests = [
886 ("Basic forward motion from the start of a word to the end of it",
884 ("Basic forward motion from the start of a word to the end of it",
887 vec![(1, Range::new(0, 0), Range::new(0, 5))]),
885 vec![(1, Range::new(0, 0), Range::new(0, 5))]),
888 ("Basic forward motion from the end of a word to the end of the next",
886 ("Basic forward motion from the end of a word to the end of the next",
@@ -954,7 +952,7 @@ mod test {
955 (1, Range::new(0, 0), Range::new(0, 5)),
953 (1, Range::new(0, 0), Range::new(0, 5)),
959 for (sample, scenario) in tests {
957 for (sample, scenario) in tests {
960 for (count, begin, expected_end) in scenario.into_iter() {
958 for (count, begin, expected_end) in scenario.into_iter() {
@@ -966,7 +964,7 @@ mod test {
968 fn test_behaviour_when_moving_to_end_of_previous_words() {
966 fn test_behaviour_when_moving_to_end_of_previous_words() {
969− let tests = array::IntoIter::new([
967+ let tests = [
970 ("Basic backward motion from the middle of a word",
968 ("Basic backward motion from the middle of a word",
971 vec![(1, Range::new(9, 9), Range::new(10, 5))]),
969 vec![(1, Range::new(9, 9), Range::new(10, 5))]),
972 ("Starting from after boundary retreats the anchor",
970 ("Starting from after boundary retreats the anchor",
@@ -1036,7 +1034,7 @@ mod test {
1037 (1, Range::new(0, 10), Range::new(10, 4)),
1035 (1, Range::new(0, 10), Range::new(10, 4)),
1041 for (sample, scenario) in tests {
1039 for (sample, scenario) in tests {
1042 for (count, begin, expected_end) in scenario.into_iter() {
1040 for (count, begin, expected_end) in scenario.into_iter() {
@@ -1048,7 +1046,7 @@ mod test {
1050 fn test_behaviour_when_moving_to_end_of_next_long_words() {
1048 fn test_behaviour_when_moving_to_end_of_next_long_words() {
1051− let tests = array::IntoIter::new([
1049+ let tests = [
1052 ("Basic forward motion from the start of a word to the end of it",
1050 ("Basic forward motion from the start of a word to the end of it",
1053 vec![(1, Range::new(0, 0), Range::new(0, 5))]),
1051 vec![(1, Range::new(0, 0), Range::new(0, 5))]),
1054 ("Basic forward motion from the end of a word to the end of the next",
1052 ("Basic forward motion from the end of a word to the end of the next",
@@ -1118,7 +1116,7 @@ mod test {
1119 (1, Range::new(0, 0), Range::new(0, 7)),
1117 (1, Range::new(0, 0), Range::new(0, 7)),
1123 for (sample, scenario) in tests {
1121 for (sample, scenario) in tests {
1124 for (count, begin, expected_end) in scenario.into_iter() {
1122 for (count, begin, expected_end) in scenario.into_iter() {