Skip to content
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 lints #1

Merged
merged 1 commit into from May 6, 2022
Merged

Fix clippy lints #1

merged 1 commit into from May 6, 2022

Conversation

mlodato517
Copy link
Contributor

This Commit
Just fixes two small clippy lints.

Note
When handling one of the clippy lints (unnecessary return) I took a
look at f32_to_i16 and it looked to me like this was doing a
saturating cast. If that's the case then, after doing some
research
, it looks like as already does saturating casts!

@mlodato517 mlodato517 self-assigned this May 6, 2022
return -32768;
}
return sample as i16;
sample as i16
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this really works, then that's amazing

Copy link
Collaborator

@nikolawhallon nikolawhallon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nikolawhallon
Copy link
Collaborator

@mlodato517 since I would never remember this, maybe a comment that "this does a saturating cast" would be helpful

@mlodato517 mlodato517 force-pushed the mlodato517-fix-clippy-lints branch from e2ffdbc to 3b157ff Compare May 6, 2022 22:11
**This Commit**
Just fixes two small `clippy` lints.

**Note**
When handling one of the `clippy` lints (unnecessary `return`) I took a
look at `f32_to_i16` and it looked to me like this was doing a
saturating cast. If that's the case then, after [doing some
research][0], it looks like `as` [already does saturating casts][1]!

[0]: rust-lang/rust#71269
[1]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1348ce2173e812ff4199446a4fed5a99
@mlodato517 mlodato517 force-pushed the mlodato517-fix-clippy-lints branch from 3b157ff to 12775ea Compare May 6, 2022 22:13
@mlodato517
Copy link
Contributor Author

Good idea - did that!

@mlodato517 mlodato517 merged commit 742dd7d into main May 6, 2022
@mlodato517 mlodato517 deleted the mlodato517-fix-clippy-lints branch May 6, 2022 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants