Skip to content

suboptimal suggestion with match and macro expanded arms #2954

Closed
@oli-obk

Description

@oli-obk

We should rewrite this lint as a PreExpansionPass. We should rewrite a lot of lints as PreExpansionPasses...

error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
  --> $DIR/matches.rs:40:5
   |
40 | /     match tup {
41 | |         &(v, 1) => println!("{}", v),
42 | |         _ => println!("none"),
43 | |     }
   | |_____^
help: try this
   |
40 |     if let &(v, 1) = tup {
41 | # [ cfg ( not ( stage0 ) ) ] {
42 | ( $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ) ; } # [
43 | cfg ( stage0 ) ] { print ! ( "{}/n" , format_args ! ( $ ( $ arg ) * ) ) } } else {
44 | ( $ crate :: io :: _print ( format_args_nl ! ( $ ( $ arg ) * ) ) ) ; }
   |

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-help-wantedCall for participation: Help is requested to fix this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions