Skip to content

Macros are being expanded when emitting suggestions #1148

Closed
@trixnz

Description

@trixnz

When clippy reports a suggestion with a macro in the code, it seems to print the expanded form. Using the example from README.md, you can see it is not behaving as expected:

fn main(){                             
    let x = Some(1u8);                 
    match x {                          
        Some(y) => println!("{:?}", y),
        _ => ()                        
    }                                  
}

results in:

warning: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`, #[warn(single_match)] on by default
 --> src\main.rs:3:5
  |
3 |     match x {
  |     ^
  |
help: try this
  |     if let Some(y) = x { $ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) }
  = help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#single_match

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingT-macrosType: Issues with macros and macro expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions