diff --git a/Cargo.toml b/Cargo.toml index d65b97de92d..51039450148 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,7 +93,6 @@ exhaustive_structs = { level = "allow", priority = 1 } expect_used = { level = "allow", priority = 1 } float_arithmetic = { level = "allow", priority = 1 } float_cmp_const = { level = "allow", priority = 1 } -get_unwrap = { level = "allow", priority = 1 } if_then_some_else_none = { level = "allow", priority = 1 } impl_trait_in_params = { level = "allow", priority = 1 } implicit_return = { level = "allow", priority = 1 } diff --git a/src/big_integer/fast_factorial.rs b/src/big_integer/fast_factorial.rs index 80652073e17..8272f9ee100 100644 --- a/src/big_integer/fast_factorial.rs +++ b/src/big_integer/fast_factorial.rs @@ -36,7 +36,7 @@ pub fn fast_factorial(n: usize) -> BigUint { .map(|p| (p, index(p, n))) .collect::>(); - let max_bits = p_indices.get(&2).unwrap().next_power_of_two().ilog2() + 1; + let max_bits = p_indices[&2].next_power_of_two().ilog2() + 1; // Create a Vec of 1's let mut a = vec![BigUint::one(); max_bits as usize]; diff --git a/src/dynamic_programming/fibonacci.rs b/src/dynamic_programming/fibonacci.rs index a7db9f9562c..77954a32190 100644 --- a/src/dynamic_programming/fibonacci.rs +++ b/src/dynamic_programming/fibonacci.rs @@ -213,7 +213,7 @@ pub fn nth_fibonacci_number_modulo_m(n: i64, m: i64) -> i128 { let (length, pisano_sequence) = get_pisano_sequence_and_period(m); let remainder = n % length as i64; - pisano_sequence.get(remainder as usize).unwrap().to_owned() + pisano_sequence[remainder as usize].to_owned() } /// get_pisano_sequence_and_period(m) returns the Pisano Sequence and period for the specified integer m. diff --git a/src/general/huffman_encoding.rs b/src/general/huffman_encoding.rs index 864fa24c192..d1148df3b53 100644 --- a/src/general/huffman_encoding.rs +++ b/src/general/huffman_encoding.rs @@ -111,7 +111,7 @@ impl HuffmanDictionary { pub fn encode(&self, data: &[T]) -> HuffmanEncoding { let mut result = HuffmanEncoding::new(); data.iter() - .for_each(|value| result.add_data(*self.alphabet.get(value).unwrap())); + .for_each(|value| result.add_data(self.alphabet[value])); result } } diff --git a/src/math/nthprime.rs b/src/math/nthprime.rs index c246ff0b822..1b0e93c855b 100644 --- a/src/math/nthprime.rs +++ b/src/math/nthprime.rs @@ -39,8 +39,8 @@ fn get_primes(s: u64) -> Vec { fn count_prime(primes: Vec, n: u64) -> Option { let mut counter: u64 = 0; - for i in 2..primes.len() { - counter += primes.get(i).unwrap(); + for (i, prime) in primes.iter().enumerate().skip(2) { + counter += prime; if counter == n { return Some(i as u64); }