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

Formatting with format_strings=true can result in warning from rustc #5003

Open
martinvonz opened this issue Sep 24, 2021 · 0 comments
Open
Labels
only-with-option requires a non-default option value to reproduce p-low

Comments

@martinvonz
Copy link

The following few lines show the issue:

# Write config and a file with a multi-line string
$ echo -e 'format_strings = true\nmax_width = 100' > rustfmt.toml
$ echo -e 'fn main() { let _about_message = "An experimental VCS

To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/docs/tutorial.md.

Note that `jj <command> --help` gives more verbose help than `jj <command> -h` or `jj help <command>`."; }' > foo.rs

# Compilation succeeds without warnings before formatting
$ rustc foo.rs

# Format the file
$ rustfmt foo.rs

# Compilation produces a warning after formatting
$ rustc foo.rs
warning: multiple lines skipped by escaped newline
 --> foo.rs:4:97
  |
4 |   To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/docs/tutorial.md.\
  |  _________________________________________________________________________________________________^
5 | |
6 | |
7 | | Note that `jj <command> --help` gives more verbose help than `jj <command> -h` or `jj help \
  | |_ skipping everything up to and including this point

warning: 1 warning emitted

The second line of the string can be shortened to well under 100 characters and even under 70 characters and it will still reproduce.

@calebcartwright calebcartwright added only-with-option requires a non-default option value to reproduce p-low labels Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
only-with-option requires a non-default option value to reproduce p-low
Projects
None yet
Development

No branches or pull requests

2 participants