Skip to content

False positive: identity_conversion on macro-generated ? #4081

Closed
@dtolnay

Description

@dtolnay

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions