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

Re-enable cast_lossless lint by default #4864

Open
Shnatsel opened this issue Nov 29, 2019 · 4 comments

Comments

@Shnatsel
Copy link

@Shnatsel Shnatsel commented Nov 29, 2019

The cast_lossless lint has been made pedantic following #4528, with the reasoning being "It will only become a problem if the code changes in the future".

I am a happy user of this lint, and I find that converting always-lossless casts to from() calls as the lint suggests clarifies the code a great deal: it makes it explicit where truncation may happen, which makes the code much easier to understand.

As such, I believe this lint is a good candidate for clippy::style category. Perhaps its description could be revised to make the readability aspect more explicit.

@jhpratt

This comment has been minimized.

Copy link

@jhpratt jhpratt commented Nov 29, 2019

it makes it explicit where truncation may happen

That's what the "lossless" part is. Truncation can't happen with the current types. It would lint if the types changes in the future such that truncation is possible. As such, I am personally opposed to this.

@llogiq

This comment has been minimized.

Copy link
Collaborator

@llogiq llogiq commented Nov 30, 2019

I don't think that enabling this lint will be very popular. At best, it improves style (but not much, and it makes the code longer, too), and at worst it is seen as a false positive.

@flip1995

This comment has been minimized.

Copy link
Member

@flip1995 flip1995 commented Dec 3, 2019

I agree with @llogiq. IMO pedantic is the most fitting group for this lint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.