-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Simplify typeck/primary_body_of, fix comment to match return signature #87465
Simplify typeck/primary_body_of, fix comment to match return signature #87465
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jackh726 (or someone else) soon. Please see the contribution instructions for more information. |
Node::ImplItem(item) => match item.kind { | ||
hir::ImplItemKind::Const(ref ty, body) => Some((body, Some(ty), None, None)), | ||
hir::ImplItemKind::Fn(ref sig, body) => { | ||
Some((body, None, Some(&sig.header), Some(&sig.decl))) | ||
} | ||
hir::ImplItemKind::Const(ref ty, body) => Some((body, Some(ty), None)), | ||
hir::ImplItemKind::Fn(ref sig, body) => Some((body, None, Some(&sig))), |
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.
📌 Commit 855fa13 has been approved by |
⌛ Testing commit 855fa13 with merge 0aa151461201015b5ed488f43cfb4a96a6a46634... |
💔 Test failed - checks-actions |
@bors retry (looks spurious) |
☀️ Test successful - checks-actions |
Hi, new contributor here! I'm carefully reading through the various modules just to learn. I noticed this function,
primary_body_of
, which has gone through a couple of refactors over time, adding newOption
s to its returned tuple. Observations:fn
's documentation was not all up to date with the the current return signature.FnHeader
andFnDecl
are always bothSome
orNone
. So I figured it might just return a reference to the fullhir::FnSig
, for simplicity and more precise typing. It's a pure refactor.I'm learning better by working with code than just reading it, so here goes! If you want to avoid pure refactor PRs that don't really fix anything, I can revert the code change to only update the comment instead.