-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
name anonymous fn parameters in libcore traits #39705
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@@ -1178,8 +1178,8 @@ impl TwoWaySearcher { | |||
trait TwoWayStrategy { | |||
type Output; | |||
fn use_early_reject() -> bool; | |||
fn rejecting(usize, usize) -> Self::Output; | |||
fn matching(usize, usize) -> Self::Output; | |||
fn rejecting(a: usize, b: usize) -> Self::Output; |
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 wonder if there are more descriptive names we could use here? I don't know enough about this piece of code, but @Kimundi might.
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 tried not to be creative and used names already used by the implementations of the trait. I didn't give too much thought to this particular example as it is actually a private trait and does not appear in the docs like the others.
Edit: Looking further into this, the names a
and b
are what is actually used in the docs themselves. The variants listed in std::str::pattern::SearchStep
talk about haystack[a..b]
.
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.
Fair enough -- thanks!
@bors: r+ rollup |
📌 Commit e626a68 has been approved by |
…uron name anonymous fn parameters in libcore traits This follows the discussion in rust-lang/rfcs#1685. The patch gives names to anonymous parameters in libcore traits. It would have two benefits I can think of: firstly it would provide names to tools that can use the names from the traits, and secondly core/std can serve as an example when writing traits; this change helps by not encouraging the use of anonymous parameters.
This follows the discussion in rust-lang/rfcs#1685. The patch gives names to anonymous parameters in libcore traits. It would have two benefits I can think of: firstly it would provide names to tools that can use the names from the traits, and secondly core/std can serve as an example when writing traits; this change helps by not encouraging the use of anonymous parameters.