Skip to content

Fix cast_sign_loss false positive #3725

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 4 commits into from Feb 4, 2019
Merged

Fix cast_sign_loss false positive #3725

merged 4 commits into from Feb 4, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jan 31, 2019

This checks if the value is a non-negative constant before linting about
losing the sign.

Because the constant function doesn't handle const functions, we check if
the value is from a call to a max_value function directly. A utility method
called get_def_path was added to make checking for the function paths
easier.

Fixes #2728

This checks if the value is a non-negative constant before linting about
losing the sign.

Because the `constant` function doesn't handle const functions, we check if
the value is from a call to a `max_value` function directly. A utility method
called `get_def_path` was added to make checking for the function paths
easier.

Fixes #2728
@phansch phansch added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 31, 2019
@ghost
Copy link
Author

ghost commented Feb 1, 2019

I made the suggested changes.

Copy link
Member

@phansch phansch 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 nit, otherwise LGTM

@phansch
Copy link
Member

phansch commented Feb 4, 2019

@bors r+ thanks!

@bors
Copy link
Contributor

bors commented Feb 4, 2019

📌 Commit f3ee53d has been approved by phansch

@bors
Copy link
Contributor

bors commented Feb 4, 2019

⌛ Testing commit f3ee53d with merge 4259377...

bors added a commit that referenced this pull request Feb 4, 2019
Fix `cast_sign_loss` false positive

This checks if the value is a non-negative constant before linting about
losing the sign.

Because the `constant` function doesn't handle const functions, we check if
the value is from a call to a `max_value` function directly. A utility method
called `get_def_path` was added to make checking for the function paths
easier.

Fixes #2728
@bors
Copy link
Contributor

bors commented Feb 4, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: phansch
Pushing 4259377 to master...

@bors bors merged commit f3ee53d into rust-lang:master Feb 4, 2019
@ghost ghost deleted the fix-2728 branch May 11, 2019 08:07
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.

3 participants