Skip to content
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_possible_truncation Suggest TryFrom when truncation possible #10038

Merged
merged 4 commits into from Jan 14, 2023

Conversation

xFrednet
Copy link
Member

@xFrednet xFrednet commented Dec 6, 2022

This fixes the last issues from #9664 as the author seems to be inactive. The PR author was sadly kept during the rebase, due to the conflict resolution.

IDK if it's worth it do to a full review, I only added the last commit, everything else remained the same, besides a rebase.


changelog: Sugg: [cast_possible_truncation]: Now suggests using try_from or allowing the lint
#10038

closes: #9231

@rustbot
Copy link
Collaborator

rustbot commented Dec 6, 2022

r? @Jarcho

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 6, 2022
@xFrednet xFrednet force-pushed the 9231-sugg-try-from branch 2 times, most recently from dc887c5 to cf5db9a Compare December 6, 2022 18:07
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of edge cases noted. Otherwise LGTM.

clippy_lints/src/casts/cast_possible_truncation.rs Outdated Show resolved Hide resolved
clippy_lints/src/casts/cast_possible_truncation.rs Outdated Show resolved Hide resolved
@xFrednet
Copy link
Member Author

Good points! I've rebased, since it has been over a month. All changes are in the last commit, as well as a test for the as u32 as u16 expression.

Thank you for your patience, when it came to the update :)

@Jarcho
Copy link
Contributor

Jarcho commented Jan 14, 2023

Thank you. @bors r+

@bors
Copy link
Collaborator

bors commented Jan 14, 2023

📌 Commit 5cb6246 has been approved by Jarcho

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 14, 2023

⌛ Testing commit 5cb6246 with merge 483b7ac...

@bors
Copy link
Collaborator

bors commented Jan 14, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Jarcho
Pushing 483b7ac to master...

@bors bors merged commit 483b7ac into rust-lang:master Jan 14, 2023
@xFrednet xFrednet deleted the 9231-sugg-try-from branch January 14, 2023 17:47
@RalfJung
Copy link
Member

I am a bit surprised that this was marked as closing #9231; at least I don't see a test for usize-to-u64 casts here.

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.

Have a lint against usize-to-u64 casts (or, against *all* integer casts)
6 participants