Skip to content

fix [cast_possible_truncation] offering wrong suggestion for casting float to integer #10496

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

Merged
merged 1 commit into from
Mar 25, 2023

Conversation

J-ZhengLi
Copy link
Member

@J-ZhengLi J-ZhengLi commented Mar 13, 2023

fixes: #10366


changelog: [cast_possible_truncation] Fix incorrect suggestions when casting from float types or to _

@xFrednet
Copy link
Member

@rustbot seems to have been asleep with assigning someone this PR.

r? @Alexendoo Would you mind, since you already gave some feedback? 🙃

…ng from float

suggest `try_into` when casting to wildcard type;
fix [`cast_possible_truncation`] suggesting useless parenthesis;

remove suggesting for float to float conversion in [`cast_possible_truncation`]

style nit
@Alexendoo
Copy link
Member

Thanks @J-ZhengLi!

@bors r+

@bors
Copy link
Contributor

bors commented Mar 25, 2023

📌 Commit 52c4dc6 has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Mar 25, 2023

⌛ Testing commit 52c4dc6 with merge a6bb10a...

bors added a commit that referenced this pull request Mar 25, 2023
fix [`cast_possible_truncation`] offering wrong suggestion for casting float to integer

fixes: #10366

---

changelog:
fix [`cast_possible_truncation`] offering wrong suggestion for casting from float types, and to wildcard type;
@bors
Copy link
Contributor

bors commented Mar 25, 2023

💔 Test failed - checks-action_test

@Alexendoo
Copy link
Member

@bors retry

@bors
Copy link
Contributor

bors commented Mar 25, 2023

⌛ Testing commit 52c4dc6 with merge 5ed64d4...

@bors
Copy link
Contributor

bors commented Mar 25, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 5ed64d4 to master...

@bors bors merged commit 5ed64d4 into rust-lang:master Mar 25, 2023
@J-ZhengLi J-ZhengLi deleted the issue_10366 branch April 7, 2023 09:12
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.

cast_possible_truncation gives invalid suggestion to use _::try_from(x)
4 participants