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

bizarre string indentation with format_strings and wrap_comments #4036

Closed
AaronKutch opened this issue Feb 3, 2020 · 3 comments · Fixed by #5201
Closed

bizarre string indentation with format_strings and wrap_comments #4036

AaronKutch opened this issue Feb 3, 2020 · 3 comments · Fixed by #5201
Labels
a-macros only-with-option requires a non-default option value to reproduce

Comments

@AaronKutch
Copy link

On the latest rustfmt with a .rustfmt.toml of

format_strings = true
wrap_comments = true

and the code

macro_rules! test {
    () => {
        fn from() {
            None.expect(
                "We asserted that `buffer.len()` is exactly `$n` so we can expect \
                `ApInt::from_iter` to be successful.",
            )
        }
    };
}

This gets reformatted to

macro_rules! test {
    () => {
        fn from() {
            None.expect(
                "We asserted that `buffer.len()` is exactly `$n` so we can expect \
         `ApInt::from_iter` to be successful.",
            )
        }
    };
}

Because there is a space in there and not a whole number of indentations, I think it is some off-by-one error in some code that deals with the indentations.

@camelid

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2020

Error: This repository is not enabled to use triagebot.
Add a triagebot.toml in the root of the master branch to enable it.

Please let @rust-lang/release know if you're having trouble with this bot.

@yodaldevoid
Copy link
Contributor

yodaldevoid commented Jan 29, 2022

This bug doesn't seem to require wrap_comments now, if it ever really did.

A better title would probably be "bizarre string indentation in macro defs with format_strings".

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.

5 participants