Skip to content

Return Option rather than fail for slice_shift_char and {shift,pop}_{char,byte} - #12797

Merged
bors merged 3 commits into
rust-lang:masterfrom
pczarn:str_safety
Mar 12, 2014
Merged

Return Option rather than fail for slice_shift_char and {shift,pop}_{char,byte} #12797
bors merged 3 commits into
rust-lang:masterfrom
pczarn:str_safety

Conversation

@pczarn

Copy link
Copy Markdown
Contributor

Along the lines of shift_ref and pop_ref.

@alexcrichtonalexcrichton mentioned this pull request Mar 10, 2014
4 tasks
Comment threadsrc/libstd/str.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test could be assert_eq!(data.slice_shift_char(), (Some('ป'), "ระเทศไทย中")) (and below too).

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@alexcrichton

Copy link
Copy Markdown
Member

This looks great, thanks! Just a small comment from me and @huonw, and I think this is good to go.

Comment threadsrc/libstd/str.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you convert all of the unwraps you added to comparing against Some('...')? It makes test failures much easier to diagnose.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

bors added a commit that referenced this pull request Mar 12, 2014
Along the lines of `shift_ref` and `pop_ref`.
@borsbors closed this Mar 12, 2014
@bors
bors merged commit b0e855a into rust-lang:masterMar 12, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 9, 2022
…data, r=Veykril
feat: support associated values in "Generate Enum Variant" assist
This change adds support for associated values to the "Generate Enum Variant" assist.
I've split the implementation out into 4 steps to make code review easier:
- Add "add_variant" support to the structural ast editing system in `edit_in_place`
- Migrate `generate_enum_variant` to use structural ast editing instead of string manipulation
- Support tuple fields
- Support record fields
Please let me know if I should leave the commits as-is, or squash before merging.
Fixesrust-lang#12797
Sign up for freeto 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.

4 participants

@pczarn@alexcrichton@huonw@bors