Skip to content
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

Add .rustfmt.toml #16

Closed
wants to merge 2 commits into from
Closed

Add .rustfmt.toml #16

wants to merge 2 commits into from

Conversation

DrPoppyseed
Copy link
Contributor

Before starting work on #15, I saw that there was inconsistent formatting applied to the source code, so I added a .rustfmt.toml file and ran cargo fmt. This PR only contains automatically fixed formatting changes.

This was to make sure that any future PRs will contain less formatting "noise" and that all contributors get the same output when we run "cargo fmt"

@ad4mx
Copy link
Owner

ad4mx commented Jan 25, 2023

Hi, looks good, however is there some way you could set the amount of arguments in a function before separating them vertically in the .rustfmt.toml?
Right now, it separates a functions arguments if there are 4 or more, which creates a mess since all the functions have many arguments. If it's possible, could you set it to 5?

@DrPoppyseed
Copy link
Contributor Author

DrPoppyseed commented Jan 26, 2023

rustfmt's defaults are set to maximum character width = 80, so the function declarations (where some exceed 80 characters) will still be realigned vertically. We can set the maximum character width to 100 (from the default 80) if you prefer.
What do you think?

@ad4mx
Copy link
Owner

ad4mx commented Jan 26, 2023

Yeah, I think that could work

@@ -2,7 +2,12 @@ use spinoff::{Spinner, Spinners, Streams};
use std::{thread::sleep, time::Duration};

fn main() {
let sp = Spinner::new_with_stream(Spinners::Aesthetic, "Loading in stderr...", None, Streams::Stderr);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, this line has 106 characters, so it still gets re-aligned.
I think a max width exceeding 100 is not ideal, so some of the realignments are inescapable.
What do you think?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine if it gets re-aligned in files like these, which are just examples. It's just a bit more unreadable when it's in the actual internal code itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess we don't need to do the formatting stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants