rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Add a options "--ignore-error", ignore errors and just print back the input

Open Dangerise opened this issue 1 year ago • 4 comments

Dangerise avatar Feb 03 '24 13:02 Dangerise

Because of this

Dangerise avatar Feb 04 '24 02:02 Dangerise

@Dangerised sorry to hear that you're having issues. Some additional information would be very helpful. Most importantly we'll need a test case that can be used to reproduce the issue.

Could you go into a little more detail about what version of rustfmt you're using, if you're using any configuration options, and what editor you're using. This seems like an issue that's popped up before. This wasn't quite the issue I was looking for, but it's what I've managed to track down so far (#5172)

ytmimi avatar Feb 07 '24 02:02 ytmimi

Actually, it's not a bug, but I'm longing for this feature because it will be much better to use with other formatter.

I'm using helix editor, which requires its formatter to read from stdin and print the result to stdout, if formatter return not zero, then the code will keep the same, otherwise the editor will replace the code with stdout from the formatter

In this case, when some code with syntax error was passed to the rustfmt, rustfmt will return 1, and write nothing to stdout, but the stdout will be passed to the next formatter with pipe, then the next formatter read nothing from stdin so it also writes nothing to stdout and returns 0

Dangerise avatar Feb 07 '24 02:02 Dangerise

I see, thanks for clarifying. Marking this as a feature request

ytmimi avatar Feb 07 '24 03:02 ytmimi