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

rustfmt skip does not work on macros #2006

Closed
gnzlbg opened this issue Sep 28, 2017 · 4 comments
Closed

rustfmt skip does not work on macros #2006

gnzlbg opened this issue Sep 28, 2017 · 4 comments
Labels

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Sep 28, 2017

from stdsimd; line width set to 79 characters:

#[cfg_attr(rustfmt, rustfmt_skip)]
// #[rustfmt_skip] // does not work either
macro_rules! __unstable_detect_feature {
    ("sse") => { $crate::vendor::__unstable_detect_feature($crate::vendor::__Feature::sse{})  };
}

shows:

("sse") => { $crate::vendor::__unstable_detect_feature($crate::vendor::__Feature::sse{})  };
   |                                                                                ^^^^^^^^^^^^^^^^^

error: line exceeded maximum width (maximum: 79, found: 85)
@nrc nrc added the a-macros label Nov 2, 2017
@nrc
Copy link
Member

nrc commented Nov 2, 2017

Is it just the warning that is the issue? We don't seem to be formatting the macro itself.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Nov 2, 2017

The issue is that the error is emitted but the macro is not formated. It is possible to make this particular macro fit into 79 charactes lines, but the tool is not doing it. I had to format it manually, and then the tool doesn't emit the error.

IMO I shouldn't need to format anything manually unless I turn rustfmt off for a particular snippet of code.

@nrc
Copy link
Member

nrc commented Nov 2, 2017

But you are turning rustfmt off by using the skip attribute?

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Nov 2, 2017

No, I keep it on. This happens here: https://github.com/gnzlbg/stdsimd/blob/master/src/x86/runtime.rs#L30

If I put one of those lines in a single line, the tool emits an error but does not reformat the line properly (or at least did not do so when I filled this issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants