-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Split doc.rs
up into a subdirectory
#11801
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
Conversation
r? @blyxyas (rustbot has picked a reviewer for you, use r? to override) |
} | ||
} | ||
|
||
fn collect_doc_replacements(attrs: &[Attribute]) -> Vec<(Span, String)> { |
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.
The code in here was previously in the same function where we emit the lint but I extracted that into a separate function because I thought that looks better. If you disagree, I can change it back to have it all in the same function.
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 don't disagree, but if we're not just moving some functions into other files, you could also refactor this commit.
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.
With this lint specifically I'm more familiar since I wrote it myself, and, actually that's how it looked like before my PR #11798 where I put them into one to save space since the file was getting large.
Do you have anything in mind that can be refactored in that other commit?
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.
@blyxyas ? :)
(the file is large, wondering if you want something specific refactored)
Could you please split this into a lint per commit 🙏 so that I can review better and the commit history is clearer (they won't be squashed on merge) (^..^)ノ |
☔ The latest upstream changes (presumably #11823) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
Is there any other code change other than just changing code to files? If there isn't (outside that comment), I think this is pretty much ready.
} | ||
} | ||
|
||
fn collect_doc_replacements(attrs: &[Attribute]) -> Vec<(Span, String)> { |
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 don't disagree, but if we're not just moving some functions into other files, you could also refactor this commit.
Only in |
Oh, the lint group was also changed from |
I'll nominate this issue, let's see what the team thinks about this. If we were to change its name, it would need to be deprecated some time before being removed =^● ⋏ ●^= |
If this ends up blocking the PR, I guess I could also just revert it for this PR, just so that this can remain an "internal-only" PR. Since this touches quite a lot of code and is prone to bit rot whenever someone makes a change to doc lints (and solving conflicts here is kind of a chore), I wouldn't want to leave this open for too long |
Okis, rename the pass to I think that the review should be addressed, and that this would be pretty ready to be merge-ready! |
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.
LGTM, thanks! ❤️ I've revised these like 5 times and I still feel like there's something obvious that I don't see. Quite the GuillaumeGomez syndrome (=^-ω-^=)
😆 Careful, it doesn't get better with time. ^^' |
Oh no, I just remember that I said that they wouldn't be squashed ;( |
@bors r+ |
Split `doc.rs` up into a subdirectory So, first, sorry for the bad diff. 😅 In #11798, `@flip1995` suggested splitting `doc.rs` up, much like how we have the `methods/`, `matches/`, `types/` subdirectories. I agree with this, the file is getting bigger as we add more and more doc lints that it makes sense to do this refactoring. This is purely an internal change that moves things around a bit. (**EDIT:** depending on the outcome of #11801 (comment) , this may change the lint group name from `doc_markdoc` to `doc`). I tried to not change any of the actual logic of the lints and as such some things weren't as easy to move to a separate file. So we still have some `span_lint*` calls in the `doc/mod.rs` file, which I think is fine. This is also the case in `methods/mod.rs`. Also worth mentioning that the lints missing_errors_doc, missing_panics_doc, missing_safety_doc and unnecessary_safety_doc have a lot of the same logic so it didn't make much sense for each of these to be in their own file. Instead I just put them all in `missing_headers.rs` I also added a bit of documentation to the involved `check_{attrs,doc}` methods. changelog: none
Did bors get stuck? 🤔 |
It lost track of this PR somehow. I re-synchronized bors for Clippy. Let's see if that helps. |
Now it at least shows up as @bors retry so that it will be merged. |
Split `doc.rs` up into a subdirectory So, first, sorry for the bad diff. 😅 In #11798, `@flip1995` suggested splitting `doc.rs` up, much like how we have the `methods/`, `matches/`, `types/` subdirectories. I agree with this, the file is getting bigger as we add more and more doc lints that it makes sense to do this refactoring. This is purely an internal change that moves things around a bit. (**EDIT:** depending on the outcome of #11801 (comment) , this may change the lint group name from `doc_markdoc` to `doc`). I tried to not change any of the actual logic of the lints and as such some things weren't as easy to move to a separate file. So we still have some `span_lint*` calls in the `doc/mod.rs` file, which I think is fine. This is also the case in `methods/mod.rs`. Also worth mentioning that the lints missing_errors_doc, missing_panics_doc, missing_safety_doc and unnecessary_safety_doc have a lot of the same logic so it didn't make much sense for each of these to be in their own file. Instead I just put them all in `missing_headers.rs` I also added a bit of documentation to the involved `check_{attrs,doc}` methods. changelog: none
First bors didn't want to do anything and now they do it twice. Weird fella. |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
…Manishearth rename `DocMarkdown` pass to `Documentation` Followup of #11801 This was discussed in todays meeting: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202023-11-28/near/404667082 Decided to go with `Documentation`, because this would also make it consistent with how `Attributes` is named in `attrs.rs` (and it also sounds good). changelog: none
So, first, sorry for the bad diff. 😅
In #11798, @flip1995 suggested splitting
doc.rs
up, much like how we have themethods/
,matches/
,types/
subdirectories.I agree with this, the file is getting bigger as we add more and more doc lints that it makes sense to do this refactoring.
This is purely an internal change that moves things around a bit.
(EDIT: depending on the outcome of #11801 (comment) , this may change the lint group name from
doc_markdoc
todoc
).I tried to not change any of the actual logic of the lints and as such some things weren't as easy to move to a separate file. So we still have some
span_lint*
calls in thedoc/mod.rs
file, which I think is fine. This is also the case inmethods/mod.rs
.Also worth mentioning that the lints missing_errors_doc, missing_panics_doc, missing_safety_doc and unnecessary_safety_doc have a lot of the same logic so it didn't make much sense for each of these to be in their own file. Instead I just put them all in
missing_headers.rs
I also added a bit of documentation to the involved
check_{attrs,doc}
methods.changelog: none