Skip to content
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

Remove some of the uses of Either #9180

Closed
wants to merge 4 commits into from
Closed

Remove some of the uses of Either #9180

wants to merge 4 commits into from

Conversation

bluss
Copy link
Member

@bluss bluss commented Sep 14, 2013

Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).

blake2-ppc added 4 commits September 14, 2013 04:07
The arg or capture type alias was actually never used for the capture
case, so the code is simplified with `Either<arg, ()>` replaced by `arg`
OptRes was combining a successful value with an error message, which
fits the Result type perfectly.
Using an enum with two cases for `Work` reveals simpler code than the
previous `Option<Either<X, Y>>` representation.
OwnedString(~str),
StaticString(&'static str)
}

Copy link
Member

Choose a reason for hiding this comment

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

SendableString should probably live somewhere in libstd, as it will probably be useful for task failure too.

Maybe talk with @Aatch about implementing what he started in #7599?

Copy link
Member

Choose a reason for hiding this comment

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

Just a notice that I started working on a modernized version of #7599.

bors added a commit that referenced this pull request Sep 14, 2013
Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).
@Kimundi Kimundi mentioned this pull request Sep 14, 2013
@bors bors closed this Sep 14, 2013
bors added a commit that referenced this pull request Sep 16, 2013
A SendStr is a string that can hold either a ~str or a &'static str.
This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries.

SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings.

This basically reimplements #7599 and has a use case for replacing an similar type in `std::rt::logging` ( Added in #9180).
@wakandan wakandan mentioned this pull request Sep 16, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 28, 2022
Check `assign_op_pattern` for conflicting borrows

fixes rust-lang#9180

changelog: [`assign_op_pattern`](https://rust-lang.github.io/rust-clippy/master/#assign_op_pattern): Don't lint when the suggestion would cause borrowck errors.
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