You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
warning: taken reference of right operand
--> src/main.rs:55:31
|
55 | .filter(|d| d <= &p){// include divisors of p^2 + 1 up to p
| ^^^^^--
| |
| help:use the right value directly: `p`
|
= note: #[warn(op_ref)] on by default
= help:for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.193/index.html#op_ref
please note that the compiler won't let me use "p" in place of "&p". I followed the help link listed above and didn't understand what it was trying to tell me.
Here is the code where the warning occured:
let sieve = Sieve::new(((PLIM*PLIM)asf64).sqrt()asusize);letmut v:Vec<usize> = vec![];for p in1..PLIM{for d inFactors::new(&sieve
.factor(p*p+1).unwrap()).into_iter().filter(|d| d <= &p){// include divisors of p^2 + 1 up to plet r = (p *(p + d) + 1) / d;if r < 2_usize.pow(31){// ensure that don't exceed std::u64::MAX
v.push(p *(p + d)* r);}}}
The text was updated successfully, but these errors were encountered:
I'm confused by the following clippy warning:
please note that the compiler won't let me use "p" in place of "&p". I followed the help link listed above and didn't understand what it was trying to tell me.
Here is the code where the warning occured:
The text was updated successfully, but these errors were encountered: