Skip to content

Fix clippy warning with Rust 1.98 - #4671

Merged
ogoffart merged 1 commit into
rust-windowing:masterfrom
slint-ui:olivier/fix-clippy
Aug 21, 2026
Merged

Fix clippy warning with Rust 1.98#4671
ogoffart merged 1 commit into
rust-windowing:masterfrom
slint-ui:olivier/fix-clippy

Conversation

@ogoffart

Copy link
Copy Markdown
Contributor
error: unneeded late initialization
    --> winit-core/src/event.rs:1332:9
     |
1332 |         let altitude;
     |         ^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#needless_late_init
     = note: `-D clippy::needless-late-init` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::needless_late_init)]`
help: move the declaration `altitude` here and remove the assignments from the branches
     |
1332 ~
1333 |
1334 ~         let altitude = if self.x.abs() == 90 || self.y.abs() == 90 {
1335 ~             0.
1336 |         } else if self.x == 0 {
1337 ~             PI_0_5 - y.abs()
1338 |         } else if self.y == 0 {
1339 ~             PI_0_5 - x.abs()
1340 |         } else {
1341 |             // Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90
1342 ~             f64::atan(1. / f64::sqrt(x.tan().powi(2) + y.tan().powi(2)))
1343 ~         };
     |

```
error: unneeded late initialization
    --> winit-core/src/event.rs:1332:9
     |
1332 |         let altitude;
     |         ^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#needless_late_init
     = note: `-D clippy::needless-late-init` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::needless_late_init)]`
help: move the declaration `altitude` here and remove the assignments from the branches
     |
1332 ~
1333 |
1334 ~         let altitude = if self.x.abs() == 90 || self.y.abs() == 90 {
1335 ~             0.
1336 |         } else if self.x == 0 {
1337 ~             PI_0_5 - y.abs()
1338 |         } else if self.y == 0 {
1339 ~             PI_0_5 - x.abs()
1340 |         } else {
1341 |             // Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90
1342 ~             f64::atan(1. / f64::sqrt(x.tan().powi(2) + y.tan().powi(2)))
1343 ~         };
     |

```
@ogoffart
ogoffart merged commit c5eee2f into rust-windowing:master Aug 21, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant