Skip to content

Incorrect indentation in suggestion of collapsible_if #2974

Closed
@phansch

Description

@phansch

Adding Clippy to libsyntax2, the suggestion for the collapsible_if lint has incorrect indentation.
See https://travis-ci.org/matklad/libsyntax2/jobs/409527826#L508-L523

The suggestion is:

warning: this if statement can be collapsed
   --> src/parser/grammar/items/mod.rs:277:5
    |
277 | /     if !p.eat(SEMI) {
278 | |         if p.expect(L_CURLY) {
279 | |             mod_contents(p, true);
280 | |             p.expect(R_CURLY);
281 | |         }
282 | |     }
    | |_____^
    |
    = note: #[warn(collapsible_if)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#collapsible_if
help: try
    |
277 |     if !p.eat(SEMI) && p.expect(L_CURLY) {
278 |     mod_contents(p, true);
279 |     p.expect(R_CURLY);
280 | }
    |

It should be:

277 |     if !p.eat(SEMI) && p.expect(L_CURLY) {
278 |         mod_contents(p, true);
279 |         p.expect(R_CURLY);
280 |     }

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions