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

Do not report errors on skipped items or statements #2250

Merged
merged 3 commits into from
Dec 10, 2017

Conversation

topecongiro
Copy link
Contributor

Closes #1298.
Closes #2006.
Closes #2037.
cc #1978.

Note that this PR still warns on nested expressions with [rustfmt_skip]:

fn foo() {
    // Does not report an error.
    #[rustfmt_skip]
    let a = foo(
        vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27],
    );

    // Reports an error.
    let a = bar(
        #[rustfmt_skip] vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27],
    );
}

Handling nested expressions is hard because we do not use visitor for them. Assuming that most of the usage of #[rustfmt_skip] is on items or statements, I will send this PR anyway.

@nrc nrc merged commit 68b43b2 into rust-lang:master Dec 10, 2017
@nrc
Copy link
Member

nrc commented Dec 10, 2017

Awesome! Thank you!

@topecongiro topecongiro deleted the rustfmt-skip-no-warning-on-items branch December 11, 2017 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants