You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In issues #3206#3416#3135, wrap_str is preventing some possibly good formatting because of long strings. The return type being an Option, the fact that the rewrite failed because of a long string is lost.
If that were returning a Return, then the failure reason could be passed up for the callee to handle as appropriate.
For example, it seems the rewrite in #3416 could allow the line to overflow (which anyway would be caught by the LineOverflow logic). However, there are cases where a better formatting is possible, e.g.:
// originalfnfoo(){let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = xxxxxxx
.map(|x| x + 5).map(|x| x / 2).fold(0, |acc, x| acc + x);}// formattedfnfoo(){let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum =
xxxxxxx.map(|x| x + 5).map(|x| x / 2).fold(0, |acc, x| acc + x);}
Although in that example there is no long string, the current wrap_str logic makes that formatting possible.
With a Return as the return type, rewrite methods could be made more flexible to various kinds of errors.
However, that change would require some heavy refactoring I think.
What do you think about such a change ?
The text was updated successfully, but these errors were encountered:
In issues #3206 #3416 #3135,
wrap_str
is preventing some possibly good formatting because of long strings. The return type being anOption
, the fact that the rewrite failed because of a long string is lost.If that were returning a
Return
, then the failure reason could be passed up for the callee to handle as appropriate.For example, it seems the rewrite in #3416 could allow the line to overflow (which anyway would be caught by the
LineOverflow
logic). However, there are cases where a better formatting is possible, e.g.:Although in that example there is no long string, the current
wrap_str
logic makes that formatting possible.With a
Return
as the return type, rewrite methods could be made more flexible to various kinds of errors.However, that change would require some heavy refactoring I think.
What do you think about such a change ?
The text was updated successfully, but these errors were encountered: