Closed TristanWasTaken closed 1 month ago
Hi, thank you for contributing. This is actually the first time someone has ever created a merge request on one of my projects. I like most of your commits, but not all of them. Is there a way to go about that?
Hi, thank you for contributing. This is actually the first time someone has ever created a merge request on one of my projects. I like most of your commits, but not all of them. Is there a way to go about that?
Thanks! I'll give you a detailled list of changes later.
Please don't bother with the rustfmt, I have tried it and I think it is not ready yet. It just destroys everything.
Thanks!
Please don't bother with the rustfmt, I have tried it and I think it is not ready yet. It just destroys everything.
It just really doesn't like where you put your comments (very likely because it's not idiomatic Rust that is described in the Rust book). It works really well when I move the comments to new lines. For example when I moved the comment out of the function declaration:
- impl From<Hentai> for ComicInfoXml
- {
- fn from(hentai: Hentai) -> Self // Hentai -> ComicInfo
- {
+ impl From<Hentai> for ComicInfoXml {
+ // Hentai -> ComicInfo
+ fn from(hentai: Hentai) -> Self {
fix
clippy::needless_return
lint warnings (b4cd764)
denied
fix
clippy::needless_late_init
lint warnings (c907558)
denied
fix
clippy::map_flatten
lint warnings (12433f5, 089fc44)
approved
fix
clippy::to_string_in_format_args
lint warnings (36e184a)
approved
fix
clippy::expect_fun_call
lint warnings (d39b73c)
approved
fix
clippy::ptr_arg
lint warnings (281edc8)
approved
fix
clippy::trim_split_whitespace
lint warning (12805d0)
approved
fix
clippy::redundant_pattern_matching
lint warning (6cdc5b0)
approved
fix
clippy::suspicious_open_options
lint warning (f953f75)
approved, big thanks for that
fix
clippy::needless_borrow
lint warnings (2d01a0b)
approved
fix
clippy::needless_return
lint warnings (b4cd764)denied
fix
clippy::needless_late_init
lint warnings (c907558)denied
so that is what you meant with "It just destroys everything" 💡 Judging from your code style, I'm guessing you come from a C# background? I'm sorry, but the Rust formatter will never be "ready" since it's just not how Rust code is usually written 😅
You should document in the README.md or a CONTRIBUTING.md file that your code style is different than the community-wide agreed upon standard (idiomatic Rust). The Clippy lints and especially rustfmt follow that agreed upon style guide.
“idiomatic” language is a usage which follows the style and practices (the idioms) of the wider community.
If you don't document it, there will be clashes with other Rust devs that want to contribute and follow the normal Rust code style (e.g. C# code style for Rust just looks weird for me).
With the last 4 commits, I
I personally used rustfmt with the following settings:
blank_lines_upper_bound = 2
brace_style = "AlwaysNextLine"
combine_control_expr = false
control_brace_style = "AlwaysNextLine"
enum_discrim_align_threshold = 50
hex_literal_case = "Upper"
indent_style = "Block"
max_width = 200
struct_field_align_threshold = 50
But it kept moving comments into next lines, moving curly braces to areas where there were not supposed to be, clear bugs in edge cases, and so on. I ultimately gave up for now and will come back to it at a later time.
My needlessly early declarations and needless explicit returns are because I like structuring my functions in 3 parts, in all programming languages:
return
statements everywhere. I only don't use return
in closures, because I don't "leave" the actual function.
I ran the default clippy lints on the project. Clippy warnings ensure that you write idiomatic Rust (I recommend reading the Rust book if you haven't already), such as not calling needless returns.
At the very least the commit f953f757843205d1752f550dea0a06ccb23e2e4a should be merged, because
clippy::suspicious_open_options
might actually cause issues.Changes:
clippy::needless_return
lint warnings (b4cd7645ff9d4d92ab03344f340c44e7b05e61b7)clippy::needless_late_init
lint warnings (c907558ec8793733dce8c57cc9c8bf7d87d799fc)clippy::map_flatten
lint warnings (12433f5a11ad7ede273386f624a4bd015e160d11, 089fc447094be1e6a4e3db9f2e536f6aba6d5d6b)clippy::to_string_in_format_args
lint warnings (36e184aab559fb17d757efacbad0ba0e325d02a6)clippy::expect_fun_call
lint warnings (d39b73c9c8114fcbf92240bbe7decf65cc70a208)clippy::ptr_arg
lint warnings (281edc88ef36e757ce532935ee94cc526f9896d5)clippy::trim_split_whitespace
lint warning (12805d078d1a097d3c6b78358b213f81612191e2)clippy::redundant_pattern_matching
lint warning (6cdc5b012ee82b775dd961a6b634776c1cf2a288)clippy::suspicious_open_options
lint warning (f953f757843205d1752f550dea0a06ccb23e2e4a)clippy::needless_borrow
lint warnings (2d01a0b0999d93a67b8f72e5d530418f868b3f8d)