Skip to content

style: include get_unwrap #856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion src/big_integer/fast_factorial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn fast_factorial(n: usize) -> BigUint {
.map(|p| (p, index(p, n)))
.collect::<BTreeMap<_, _>>();

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];
Expand Down
2 changes: 1 addition & 1 deletion src/dynamic_programming/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/general/huffman_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<T: Clone + Copy + Ord> HuffmanDictionary<T> {
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
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/math/nthprime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ fn get_primes(s: u64) -> Vec<u64> {

fn count_prime(primes: Vec<u64>, n: u64) -> Option<u64> {
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);
}
Expand Down
Loading