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
Checking playground v0.0.1 (/playground)
warning: casting u16 to u32 may become silently lossy if types change
--> src/main.rs:2:23
|
2 | 0b11_1111_1111 | ((ioport as u32) << 11)
| ^^^^^^^^^^^^^^^ help: try: `u32::from(ioport)`
|
= note: #[warn(clippy::cast_lossless)] on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
Finished dev [unoptimized + debuginfo] target(s) in 1.39s
…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
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: