diff --git a/core/src/fibbonacci.rs b/core/src/fibbonacci.rs index a787b69..0086937 100644 --- a/core/src/fibbonacci.rs +++ b/core/src/fibbonacci.rs @@ -4,8 +4,8 @@ pub fn fibbonacci(index: usize) -> usize { } else if index < 3 { 1 } else { - let mut values = vec![1;index+1]; - for i in 3..index+1 { + let mut values = vec![1; index + 1]; + for i in 3..index + 1 { values[i] = values[i - 1] + values[i - 2]; } values[index] @@ -18,7 +18,7 @@ mod tests { #[test] fn test_first_few_values() { - let expected_values = vec![ + let expected_values = [ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, ]; diff --git a/core/src/rope/mod.rs b/core/src/rope/mod.rs index 9c69e96..10d6b12 100644 --- a/core/src/rope/mod.rs +++ b/core/src/rope/mod.rs @@ -1,5 +1,5 @@ use super::fibbonacci::fibbonacci; -pub use std::rc::Rc; +use std::rc::Rc; /// [Rope](https://en.wikipedia.org/wiki/Rope_(data_structure)) data structure /// implementation. diff --git a/core/src/rope/tests/command_list.rs b/core/src/rope/tests/command_list.rs index bc7b2e1..09d9d92 100644 --- a/core/src/rope/tests/command_list.rs +++ b/core/src/rope/tests/command_list.rs @@ -45,12 +45,12 @@ pub fn generate_random_edit_sequence_with_seed( seed: u64, ) -> (String, Vec<(Command, String)>) { let mut rng = SmallRng::seed_from_u64(seed); - let start_text_length = rng.random_range(0..4000); + let start_text_length = rng.random_range(0..length); let start_text = Alphanumeric.sample_string(&mut rng, start_text_length); let num_steps = rng.random_range(0..1000); let mut steps = Vec::with_capacity(num_steps); let mut current_text = start_text.clone(); - for i in 0..num_steps { + for _ in 0..num_steps { let current_text_length = current_text.len(); let command = if rng.random_bool(0.7) || current_text_length > 0 { let index = rng.random_range(0..current_text_length);