2
lorentz
170d

Rustfmt doesn't support inline function calls with a block last argument unless the last argument is an array literal or lambda. Dedicated support for arrays is obviously intended for XML-like trees where a factory takes a number of arguments and then a list of children, and the use cases for block last lambda argument don't need explanation, but what I don't get is how did no one catch on that this is a useful pattern that should perhaps be generalized? Why can't I produce the same behaviour for a function call in the last position.

Comments
  • 0
    @ostream This is a problem I've experienced with every formatter, especially ones which authoritatively decide everything they can change without taking into account existing formatting.
  • 0
    @ostream It's not really about the inflexibility of the language. I want to use nested function calls because I want the API to reflect the extension points of the module.
  • 0
    @ostream The main issue about Rust here is that in absence of keyword arguments and default values, optionals are tedious and the least worst way to accept them is with a Builder.
Add Comment