Skip to content

identity_conversion triggered when coming from ? desugaring #3944

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

Closed
estebank opened this issue Apr 11, 2019 · 3 comments
Closed

identity_conversion triggered when coming from ? desugaring #3944

estebank opened this issue Apr 11, 2019 · 3 comments

Comments

@estebank
Copy link
Contributor

I got the following error:

clippy 0.0.212 (37f5c1ec 2019-04-09)

error: identical conversion
   --> src/json_read.rs:316:24
    |
316 |             for raw in map.next_value::<Vec<&RawValue>>()? {
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `map.next_value::<Vec<&RawValue>>()?()`: `map.next_value::<Vec<&RawValue>>()?`
    |
note: lint level defined here
   --> src/lib.rs:2:44
    |
2   | #![cfg_attr(feature = "cargo-clippy", deny(warnings))]
    |                                            ^^^^^^^^
    = note: #[deny(clippy::identity_conversion)] implied by #[deny(warnings)]
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

It seems to me that the .into() that's being complained about is coming from the ? operator. The lint should verify that the span isn't coming from this desugaring before triggering.

@flip1995
Copy link
Member

This is already tracked in #3913

@flip1995
Copy link
Member

I just tried to fix this here: flip1995@621a435

But that didn't work, because the From::from call Clippy complains about has the same span as expr?, which didn't come from desugaring.

@estebank
Copy link
Contributor Author

@flip1995 I believe we can get around that by touching https://github.com/rust-lang/rust/blob/9217fe0e2f04d61dd29c9aaebee2c993705e1d26/src/librustc/hir/lowering.rs#L4667-L4774

We can mark any of the mentioned spans with CompilerDesugaringKind::QuestionMark as a reason, we just need to identify which span it should be (or mark all of them, which should be fine, depending on how that mark is used elsewhere).

danieldk added a commit to stickeritis/sticker that referenced this issue May 26, 2019
danieldk added a commit to stickeritis/sticker that referenced this issue May 26, 2019
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

No branches or pull requests

2 participants