Skip to content

Lint enum-to-int casts with cast_possible_truncation#8381

Merged
bors merged 3 commits into
rust-lang:masterfrom
Jarcho:cast_possible_truncation_542
Feb 18, 2022
Merged

Lint enum-to-int casts with cast_possible_truncation#8381
bors merged 3 commits into
rust-lang:masterfrom
Jarcho:cast_possible_truncation_542

Conversation

@Jarcho

@Jarcho Jarcho commented Jan 31, 2022

Copy link
Copy Markdown
Contributor

fixes: #542

This will not lint casting a specific variant to an integer. That really should be a new lint as it's definitely a truncation (other than isize/usize values).

changelog: Lint enum-to-int casts with cast_possible_truncation
changelog: New lint cast_enum_truncation

@rust-highfive

Copy link
Copy Markdown

r? @Manishearth

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 31, 2022
@Jarcho Jarcho force-pushed the cast_possible_truncation_542 branch 2 times, most recently from d275208 to ece4d65 Compare February 1, 2022 04:46
Comment thread clippy_lints/src/casts/cast_possible_truncation.rs Outdated
@bors

bors commented Feb 18, 2022

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #8419) made this pull request unmergeable. Please resolve the merge conflicts.

@Jarcho Jarcho force-pushed the cast_possible_truncation_542 branch 3 times, most recently from 99d7050 to 5ed4827 Compare February 18, 2022 14:36
@Jarcho Jarcho force-pushed the cast_possible_truncation_542 branch from 5ed4827 to 88ecdd0 Compare February 18, 2022 14:47
@Manishearth

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Feb 18, 2022

Copy link
Copy Markdown
Contributor

📌 Commit 88ecdd0 has been approved by Manishearth

@bors

bors commented Feb 18, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit 88ecdd0 with merge 73367f8...

@bors

bors commented Feb 18, 2022

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 73367f8 to master...

@bors bors merged commit 73367f8 into rust-lang:master Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

warn on casting enum to numeric value

4 participants