Skip to content

Refactored while_some (libstd/option.rs) #12871

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

Closed
wants to merge 1 commit into from
Closed

Refactored while_some (libstd/option.rs) #12871

wants to merge 1 commit into from

Conversation

aochagavia
Copy link
Contributor

The old 'while' needed to match 2 times for each iteration. With the new 'loop' there is just one match needed.

I have also replaced 'blk' by 'f' to be more consistent with parameter names in other functions that are implemented for Option

@alexcrichton
Copy link
Member

The PR title/description listed is quite nice, but it seems to be missing from the commit message itself. Could you put the two in sync?

@aochagavia
Copy link
Contributor Author

How can I do that? I am not very experienced with GitHub and pull requests...

@alexcrichton
Copy link
Member

You can use git commit --amend to change the message of the previous commit, and then use git push -f to force-push the commit to your branch.

The old 'while' needed to match 2 times for each iteration. With the new
'loop' there is just one match needed.

I have also replaced 'blk' by 'f' to be more consistent with parameter
names in other functions that are implemented for Option
@aochagavia
Copy link
Contributor Author

Is this what you mean?

bors added a commit that referenced this pull request Mar 14, 2014
…chton

The old 'while' needed to match 2 times for each iteration. With the new 'loop' there is just one match needed.

I have also replaced 'blk' by 'f' to be more consistent with parameter names in other functions that are implemented for Option<T>
@bors bors closed this Mar 14, 2014
@aochagavia aochagavia deleted the Optimize-while_some branch May 13, 2014 06:43
fasterthanlime pushed a commit to fasterthanlime/rust that referenced this pull request Jul 26, 2022
…ykril

Sync from `rust-lang/rust`

This is the first subtree sync PR from `rust-lang/rust` to `rust-lang/rust-analyzer`, made by following the instructions at: https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html#performing-the-sync-from-rust-langrust-to-clippy

It includes all the commits that were made in:

  * rust-lang#99603

(And that were reviewed ahead of time by `@Veykril` + `@lnicola)`
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 13, 2024
Modify str_to_string to be machine-applicable

Fixes rust-lang/rust-clippy#12768

I'm not sure if there is any potential for edge cases with this - since it only ever acts on `&str` types I can't think of any, and especially since the methods do the same thing anyway.

changelog: allow `str_to_string` lint to be automatically applied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants