riker-rs / riker

Easily build efficient, highly concurrent and resilient applications. An Actor Framework for Rust.
https://riker.rs
MIT License
1.02k stars 69 forks source link

Format code with new rustfmt #56

Closed riemass closed 4 years ago

riemass commented 5 years ago

New rustfmt.toml file is ready. Please review and comment on the settings. These are mostly sane defaults. For feature merge requests it would be obligatory to follow the format, sparing time on manual formatting, having an consistent code and preventing situations where someone accidentally pushes someone else's code that was just reformatted.

Because most of the code is authored by @leenozara , it would be the best for if he could run cargo fmt on the entire project and immediately push the formatted code.

Please note that for rustfmt versions before "1.3.3" fail to format kernel_ref.rs. The required version is available in today's nightly release, or can be downloaded from the rustfmt project repository.

leenozara commented 5 years ago

@riemass the settings look good to me.

Give me a couple of days to think when to cargo fmt, whether before 0.3.1 release or after. Thanks!

riemass commented 5 years ago

Sounds good. You're welcome.

leenozara commented 5 years ago

Just to update you on this, I'll be merging the config and doing a cargo fmt in the couple of days. Will confirm once I've done it.

leenozara commented 5 years ago

@riemass Looks like there is a problem with rust-fmt and clippy on the last few nightly toolchain releases.

rustup component add rustfmt
error: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel 'nightly'
If you require these components, please install and use the latest successful build version,
which you can find at https://rust-lang-nursery.github.io/rust-toolstate.

After determining the correct date, install it with a command such as:

    rustup toolchain install nightly-2018-12-27

Then you can use the toolchain with commands such as:

    cargo +nightly-2018-12-27 build

This prevents rust-fmt from being installed.

cargo +stable fmt works on the stable toolchain but throws a bunch of errors:

Warning: Unknown configuration option `format_code_in_doc_comments`
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 80`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = false`, unstable features are only available in nightly channel.
Warning: can't set `format_strings = true`, unstable features are only available in nightly channel.
Warning: can't set `where_single_line = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_indent = Block`, unstable features are only available in nightly channel.
Warning: can't set `imports_layout = HorizontalVertical`, unstable features are only available in nightly channel.
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = true`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = true`, unstable features are only available in nightly channel.
Warning: can't set `match_block_trailing_comma = true`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_upper_bound = 2`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_lower_bound = 0`, unstable features are only available in nightly channel.
Warning: can't set `version = Two`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.
Warning: Unknown configuration option `format_code_in_doc_comments`
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 80`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = false`, unstable features are only available in nightly channel.
Warning: can't set `format_strings = true`, unstable features are only available in nightly channel.
Warning: can't set `where_single_line = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_indent = Block`, unstable features are only available in nightly channel.
Warning: can't set `imports_layout = HorizontalVertical`, unstable features are only available in nightly channel.
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = true`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = true`, unstable features are only available in nightly channel.
Warning: can't set `match_block_trailing_comma = true`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_upper_bound = 2`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_lower_bound = 0`, unstable features are only available in nightly channel.
Warning: can't set `version = Two`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.
Warning: Unknown configuration option `format_code_in_doc_comments`
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 80`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = false`, unstable features are only available in nightly channel.
Warning: can't set `format_strings = true`, unstable features are only available in nightly channel.
Warning: can't set `where_single_line = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_indent = Block`, unstable features are only available in nightly channel.
Warning: can't set `imports_layout = HorizontalVertical`, unstable features are only available in nightly channel.
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = true`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = true`, unstable features are only available in nightly channel.
Warning: can't set `match_block_trailing_comma = true`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_upper_bound = 2`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_lower_bound = 0`, unstable features are only available in nightly channel.
Warning: can't set `version = Two`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.
Warning: Unknown configuration option `format_code_in_doc_comments`
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 80`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = false`, unstable features are only available in nightly channel.
Warning: can't set `format_strings = true`, unstable features are only available in nightly channel.
Warning: can't set `where_single_line = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_indent = Block`, unstable features are only available in nightly channel.
Warning: can't set `imports_layout = HorizontalVertical`, unstable features are only available in nightly channel.
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = true`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = true`, unstable features are only available in nightly channel.
Warning: can't set `match_block_trailing_comma = true`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_upper_bound = 2`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_lower_bound = 0`, unstable features are only available in nightly channel.
Warning: can't set `version = Two`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.
Warning: Unknown configuration option `format_code_in_doc_comments`
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 80`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = false`, unstable features are only available in nightly channel.
Warning: can't set `format_strings = true`, unstable features are only available in nightly channel.
Warning: can't set `where_single_line = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_indent = Block`, unstable features are only available in nightly channel.
Warning: can't set `imports_layout = HorizontalVertical`, unstable features are only available in nightly channel.
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = true`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = true`, unstable features are only available in nightly channel.
Warning: can't set `match_block_trailing_comma = true`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_upper_bound = 2`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_lower_bound = 0`, unstable features are only available in nightly channel.
Warning: can't set `version = Two`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.
Warning: Unknown configuration option `format_code_in_doc_comments`
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 80`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = false`, unstable features are only available in nightly channel.
Warning: can't set `format_strings = true`, unstable features are only available in nightly channel.
Warning: can't set `where_single_line = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_indent = Block`, unstable features are only available in nightly channel.
Warning: can't set `imports_layout = HorizontalVertical`, unstable features are only available in nightly channel.
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = true`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = true`, unstable features are only available in nightly channel.
Warning: can't set `match_block_trailing_comma = true`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_upper_bound = 2`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_lower_bound = 0`, unstable features are only available in nightly channel.
Warning: can't set `version = Two`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.
Warning: Unknown configuration option `format_code_in_doc_comments`
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `comment_width = 80`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = false`, unstable features are only available in nightly channel.
Warning: can't set `format_strings = true`, unstable features are only available in nightly channel.
Warning: can't set `where_single_line = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_indent = Block`, unstable features are only available in nightly channel.
Warning: can't set `imports_layout = HorizontalVertical`, unstable features are only available in nightly channel.
Warning: can't set `merge_imports = true`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = true`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = true`, unstable features are only available in nightly channel.
Warning: can't set `match_block_trailing_comma = true`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_upper_bound = 2`, unstable features are only available in nightly channel.
Warning: can't set `blank_lines_lower_bound = 0`, unstable features are only available in nightly channel.
Warning: can't set `version = Two`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `skip_children = false`, unstable features are only available in nightly channel.

Due to nightly being required. Files do get formatted however - just not using the settings we want.

Do you get the same problem on the latest rustc nightly?

riemass commented 5 years ago

That is a usual problem with tooling on nightly. The releases happen daily and often the tooling build breaks. As seen here not a single nightly in the last week did have both rustfmt and clippy. The release nightly-2019-07-25 is the latest that features rustfmt. As you are mentioning rustfmt and clippy, I can confirm that nightly-2019-07-17 formats the project regularly, and has both clippy and rustfmt. cargo +nightly-2019-07-17 fmt I tend to update nightly only on days all the plugins I use compile regularly and live with it. I can make another MR with the unstable features taken out so we can have an easier transition towards stable once async/await gets stable.

leenozara commented 5 years ago

Thanks for confirming. Let's go with your suggestion of removing unstable features and revisit once async/await is stable.

riemass commented 5 years ago

New MR created. Unstable had quite useful features. Hope to see them stabilized at some point.