-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Fix has_no_input_arg
check and rename it to has_only_self_parameter
#71270
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_typeck/check/demand.rs
Outdated
@@ -246,7 +246,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
// This function checks if the method isn't static and takes other arguments than `self`. |
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 am confusing about this comment, is this correct?
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.
It's a confusing comment. And the name of the function is also probably wrong. cc @estebank
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 think maybe the function actually wants to do is to check that the function only has a self arg and no other args.
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.
This code seems to only be used for suggestions to convert a type in a whitelist, so I think the "has no input arg" should be read/rewritten as "check that this associated item can be called without any additional arguments, like <&str>::to_string(self)". Feel free to rewrite the docstring and method name.
The code change seems correct, r=me on that.
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.
61ac0dc
to
8a32e51
Compare
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> rename has_no_input_arg to has_only_self_parameter Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
8a32e51
to
7c28dfe
Compare
has_no_input_arg
function has self checkhas_no_input_arg
to has_only_self_parameter
has_no_input_arg
to has_only_self_parameter
has_no_input_arg check
and rename it to has_only_self_parameter
has_no_input_arg check
and rename it to has_only_self_parameter
has_no_input_arg
check and rename it to has_only_self_parameter
@bors r+ rollup |
📌 Commit 7c28dfe has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#71250 (Replace big JS dict with JSON parsing) - rust-lang#71270 (Fix `has_no_input_arg` check and rename it to `has_only_self_parameter`) - rust-lang#71284 (fix -Zast-json to output correct JSON form) - rust-lang#71328 (Stabilize PathBuf capacity methods) - rust-lang#71334 (Update pattern docs.) Failed merges: r? @ghost
Signed-off-by: Rustin-Liu rustin.liu@gmail.com
Fixes #70643 (comment).