-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
cast_lossless is triggered on const fn #3656
Labels
C-bug
Category: Clippy is not doing the correct thing
Comments
This was referenced Jan 25, 2019
bors
added a commit
that referenced
this issue
Jan 28, 2019
…t_fn, r=oli-obk Prevent incorrect cast_lossless suggestion in const_fn `::from` is not a const fn, so applying the suggestion of `cast_lossless` would fail to compile. The fix is to skip the lint if the cast is found inside a const fn. Fixes #3656
So this issue still occurs if the |
bors
added a commit
that referenced
this issue
Aug 30, 2019
Fix cast_lossless false positive in impl const fn Fixes #3656 (comment) changelog: Fix false positive in `cast_lossless`
bors
added a commit
that referenced
this issue
Aug 30, 2019
Fix cast_lossless false positive in impl const fn Fixes #3656 (comment) changelog: Fix false positive in `cast_lossless`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This triggers the cast_lossless lint:
However,
u32::from
is not a const fn, and thus the suggested replacement will fail. Link to playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e5a19374d44dd33555594f205a7b3aa5Clippy version: clippy 0.0.212 (39bd844 2018-12-30)
The text was updated successfully, but these errors were encountered: