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

Extra indentation in macro_rules! #4152

Closed
UltraMachine opened this issue May 1, 2020 · 1 comment · Fixed by #4166
Closed

Extra indentation in macro_rules! #4152

UltraMachine opened this issue May 1, 2020 · 1 comment · Fixed by #4166
Labels
a-macros only-with-option requires a non-default option value to reproduce

Comments

@UltraMachine
Copy link

rustfmt 1.4.12-stable (a828ffe 2020-03-11)

For example, this:

macro_rules! bit {
    ($bool:expr) => {
        if $bool {
            1
        } else {
            0
        }
    };
}
macro_rules! add_one {
    ($vec:expr) => {
        {
            $vec.push(1);
        }
    };
}

Formatted into:

macro_rules! bit {
    ($bool:expr) => {
        if $bool {
                1
        } else {
                0
            }
    };
}
macro_rules! add_one {
    ($vec:expr) => {{
        $vec.push(1);
        }};
}
@UltraMachine
Copy link
Author

I have this issue when hard_tabs = true

@calebcartwright calebcartwright added a-macros only-with-option requires a non-default option value to reproduce labels May 1, 2020
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue May 10, 2020
Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < "    ".len()).

Closes rust-lang#4152
topecongiro pushed a commit that referenced this issue May 10, 2020
Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < "    ".len()).

Closes #4152
bradleypmartin pushed a commit to bradleypmartin/rustfmt that referenced this issue May 25, 2020
…#4166)

Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < "    ".len()).

Closes rust-lang#4152
calebcartwright pushed a commit to calebcartwright/rustfmt that referenced this issue Nov 29, 2020
…#4166)

Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < "    ".len()).

Closes rust-lang#4152
calebcartwright pushed a commit that referenced this issue Nov 29, 2020
Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < "    ".len()).

Closes #4152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-macros only-with-option requires a non-default option value to reproduce
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants