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

False positive: identity_conversion on macro-generated ? #4081

Closed
dtolnay opened this issue May 12, 2019 · 1 comment · Fixed by #4082
Closed

False positive: identity_conversion on macro-generated ? #4081

dtolnay opened this issue May 12, 2019 · 1 comment · Fixed by #4082
Labels
I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@dtolnay
Copy link
Member

dtolnay commented May 12, 2019

This is a regression in the most recent nightly because I just started seeing Travis failures related to this.

If you take the macro-generated code and paste it into main.rs, the same lint does not trigger.

$ cat Cargo.toml 
[package]
name = "repro"
version = "0.0.0"
edition = "2018"

[lib]
proc-macro = true
$ cat src/lib.rs 
extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro]
pub fn m(_input: TokenStream) -> TokenStream {
    "fn f() -> Result<(), ()> { Ok(())?; Ok(()) }"
    .parse().unwrap()
}
$ cat src/main.rs 
repro::m!();

fn main() {}
$ cargo clippy
    Checking repro v0.0.0 (/git/repro)
warning: identical conversion
 --> src/main.rs:1:12
  |
1 | repro::m!();
  |            ^
  |
  = note: #[warn(clippy::identity_conversion)] on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion
$ cargo clippy -V
clippy 0.0.212 (3710ec5 2019-05-11)
@Manishearth
Copy link
Member

Yeah, we had to change how the macro checks work because of some changes wrt if desugaring. I'll insert a stronger check for that lint.

bors added a commit that referenced this issue May 12, 2019
Make most macro checks also check for desugarings

We should audit the macro checks one by one and re-add `in_macro`. I suspect it's applicable to most of them.

fixes #4081
@rustbot rustbot added the I-false-positive Issue: The lint was triggered on code it shouldn't have label Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants