Skip to content

Pretty printer could use heuristics to detect pointless line breaks #882

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

Closed
marijnh opened this issue Sep 7, 2011 · 1 comment
Closed
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`)

Comments

@marijnh
Copy link
Contributor

marijnh commented Sep 7, 2011

The most glaring example is

r =
    {some long expression that did not fit
     on a line};

... where the line break doesn't even create any space. But there are other situations, like

let foo =
    {multiline: record,
     literal: 100};

Here the literal would have fit just fine without the line break. We could probably make it not add the line break if the first line of the following block fits on a line. (Though that information is not currently being produced by the 'new' pretty-printer.)

@graydon
Copy link
Contributor

graydon commented Feb 14, 2012

This is too vague to act on in its current state. I'm sympathetic but it's unlikely to be fixed since the pp doesn't have this sort of information and we don't have any sort of algorithmic formulation of the terms involved. Reopen if you can figure something out.

@graydon graydon closed this as completed Feb 14, 2012
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
* Consider even atomic loads as non-active writing

* Fix dso local nofree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`)
Projects
None yet
Development

No branches or pull requests

2 participants