-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fix clippy warnings #75
Conversation
Use copy_nonoverlapping instead when it makes sense
examples/pwm.rs
Outdated
@@ -96,7 +96,7 @@ fn main() -> ! { | |||
} | |||
|
|||
for i in 0..3 { | |||
let duty = (sin(duties[i] * 3.14159265f32 / 180f32) * 255f32) as u16; | |||
let duty = (sin(duties[i] * 3.141_592_7_f32 / 180f32) * 255f32) as u16; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed value – was that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good catch. That's something that was done by cargo clippy --fix
. I think it's because the value is parsed as a f32
then re-encoded, the binary representation of both is the same.
fn main() {
assert_eq!(3.14159265f32, 3.141_592_7_f32);
}
does not panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I overlooked that this is only the decimal part. Makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll actually make this use f32::consts::PI
.
Hmm, and now I discover that |
Built on top of #74