-
Notifications
You must be signed in to change notification settings - Fork 13k
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 .editorconfig #81260
Add .editorconfig #81260
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
By the way, the pull request itself does NOT have the .editorconfig removed, when I see it through github UI. |
Was there at any time a |
Those do not come from |
Oh, I think you're right! Those aren't even submodules, but, from the looks of it, git trees merged directly into the git trees of rust-the-language within the same repository. With that in mind, I guess the answer would change. Rust-the-language repo didn't have Given this context, would it make sense to add it? The commit would have to be rewritten to say "add" instead of "restore", but that's doable. |
Hm, so I am inclined to say that adding this wouldn't be necessary, but I don't know much about editor configs. Most files in Rust projects use the same basic settings so I'd guess this is probably not too necessary for most people. That said adding it does seem relatively low cost. I'm going to nominate for T-compiler, perhaps someone feels more strongly. I am inclined to just r+ though if there aren't really any concerns, though it would be good to update the PR title and description now that we know it's not just being re-added. Maybe some folks from @rust-lang/clippy can say why they added or what the maintenance etc was like over time (I assume low to nonexistent). |
Hey, thanks. Given that it wasn't really a removal in the first place, I don't feel strongly about it and I'd be okay if we don't proceed with merging as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case it is decided to add .editorconfig
in the end :-)
Also, please reword the commit & the title of the PR.
So there are exactly two commits for the rust-lang/rust-clippy@c2baf5f (added -> rust-lang/rust-clippy#1107) I really don't think this is necessary with rust files, because almost everyone uses rust-analyzer with a If this should be added to rust-lang/rust, please keep it consistent with the |
Discussed during T-compiler meeting today; we are inclined to merge but I will need to review this to make sure it's consistent with our rules. If you could update the PR title and description to reflect the state (i.e., that we are not restoring) that would be good. |
Please don't forget to also update the |
7d59b09
to
e88cd5c
Compare
@Mark-Simulacrum thanks! I've changed the title in the PR, ammended the commit to fix its wording and made |
I'm not sure if it makes the best sense to keep an |
Clippy is mainly developed in a separate repo, which also benefits from a |
src/tools/clippy/.editorconfig
Outdated
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to make it equal to the root .editorconfig
and to follow best practices:
https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file
Note that it is a good style to always put the newline as a last character if it is allowed by the file format. Furthermore, for example, for C and C++ header files it is required by the language standard.
That is not important at all though, if desired, I can remove it here and in the other file. Really doesn't worth much time as far as I'm concerned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flip1995 I'm again not sure how important this is for you, but the current document in the PR has exactly one newline at the end of file:
Or as shown in github: https://github.com/rust-lang/rust/blob/af89037f19303a6b97dac6fbab45552c44c8c97a/.editorconfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean this shouldn't be a blocker for merging this. But these are 2 newlines at the end of the file. One after line 21 and then one in line 22. See for example any other file in the repo, e.g.:
Line 35 in 9fa9b58
] |
This file also has a newline at the end of the file, but GitHub (and most editors) don't display an extra newline after the last line in the document.
In other words if you run cat .editorconfig
the output will be
$ cat .editorconfig
...
indent_size = 2
$
If you run cat rustfmt.toml
you get the output:
$ cat rustfmt.toml
...
]
$
If you wouldn't have a newline at the end of the file, you would get the output
$ cat .editorconfig
...
indent_size = 2$
(I'm aware that this is next level nitpicking)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks, I never knew editors (mousepad, nano, kate) display data this way. I confirmed with hexdump -C
, however. I've removed the extra newline as you asked.
r=me with commits squashed. It also looks like your git config has a different email from your github account (fine if you want that, just wanted to mention in case it's unintentional). |
Editorconfig is a lightweight specification that helps maintaining consistent coding/formatting style accross editors, especially those editors that are not explicitly aware of Rust and rustfmt. https://editorconfig.org/
0b115ed
to
ae3164e
Compare
@Mark-Simulacrum squashed & pushed |
@bors r+ rollup |
📌 Commit ae3164e has been approved by |
…Simulacrum Add .editorconfig This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.
…Simulacrum Add .editorconfig This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.
Rollup of 14 pull requests Successful merges: - rust-lang#80593 (Upgrade Chalk) - rust-lang#81260 (Add .editorconfig) - rust-lang#81455 (Add AArch64 big-endian and ILP32 targets) - rust-lang#81517 (Remove remnants of the santizer runtime crates from bootstrap) - rust-lang#81530 (sys: use `process::abort()` instead of `arch::wasm32::unreachable()`) - rust-lang#81544 (Add better diagnostic for unbounded Abst. Const) - rust-lang#81588 (Add doc aliases for "delete") - rust-lang#81603 (rustbuild: Don't build compiler twice for error-index-generator.) - rust-lang#81634 (Add long explanation e0521) - rust-lang#81636 (Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on) - rust-lang#81647 (Fix bug with assert!() calling the wrong edition of panic!().) - rust-lang#81655 (Improve wording of suggestion about accessing field) - rust-lang#81665 (Fix out of date `Scalar` documentation) - rust-lang#81671 (Add more associated type tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…Simulacrum Add .editorconfig This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.
This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.