-
Notifications
You must be signed in to change notification settings - Fork 892
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
Left floating chain call #566
Comments
I agree that 1 is sub-optimal. 2 would require a different option (I can't recall which one off the top of my head). I think we could do 3, I wonder how generally applicable it would be? The downside is that the unwrap gets kind of lost amongst the arguments. |
let program = glium::Program::from_source(&display,
&include_str!("./shaders/vertex.glsl"),
&include_str!("./shaders/fragment.glsl"),
None)
.unwrap(); This might not be the prettiest solution but it's more general. |
Running across this issue myself (interestingly with the exact same function), I can't actually find the option to format it like 2 mentioned by @nrc. I went over the options multiple times trying different ones to see if they would work but none did. |
There's no such option yet, at this moment. Personally, I'm not super keen to implement them at this point as they have their own downsides. I'd rather further explore our options here. |
Currently I'm now using the following in my own code: let program = Program::from_source(
&display,
include_str!("vert.glsl"),
include_str!("frag.glsl"),
None
)
.unwrap(); This allows chaining as much behind it as I would want and doesn't look weirdly detached. It does however conflict with what overall is the default in rustfmt, I'm just mentioning it as an additional option. |
I think that the core of a problem here is that aligning function arguments to Consider let mut g_buffer = MultiOutputFrameBuffer::with_depth_buffer(api.facade,
[("color", &g_albedo)]
.iter()
.cloned(),
&g_depth); this looks awful even without How such code is formatted in the wild? I found this example. |
Speaking for myself, |
There are some more opinions (in favor of 2) here: https://users.rust-lang.org/t/how-do-you-format-multy-argument-function-calls/4946/2 |
While this proposal still has the same problem as we currently have, it is definitely an improvement, I wonder if it is worth doing in the short term? |
@crumblingstatue are you hitting this with the new release (0.5) or 0.4? |
Thanks! |
The lack of option 2 with rustfmt is one of the big blockers preventing me from using rustfmt. |
rustfmt now offers option 2 with |
Closing since with the defualt RFC style we do not have floating chain. |
For my code,
rustfmt
applies this formatting:This
unwrap
feels a little lonely :(I don't know a way of formatting this really well, but this two options are somewhat better in my opinion
The text was updated successfully, but these errors were encountered: