mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
factor::Factors::add: Split up to work without NLL
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
This commit is contained in:
parent
36a2948959
commit
4c3682aec7
1 changed files with 2 additions and 1 deletions
|
@ -44,7 +44,8 @@ impl Factors {
|
||||||
|
|
||||||
fn add(&mut self, prime: u64, exp: u8) {
|
fn add(&mut self, prime: u64, exp: u8) {
|
||||||
assert!(exp > 0);
|
assert!(exp > 0);
|
||||||
self.f.insert(prime, exp + self.f.get(&prime).unwrap_or(&0));
|
let n = *self.f.get(&prime).unwrap_or(&0);
|
||||||
|
self.f.insert(prime, exp + n);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push(&mut self, prime: u64) {
|
fn push(&mut self, prime: u64) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue