-
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
Remove std::either #9157
Comments
I agree. I can't think of a situation where using |
I'm looking at what current uses of Either can be migrated/refined. Some of them are using it just like a Result. |
What do you think about these two? They don't exactly follow the pattern of
|
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).
Hi I'm new to Rust and want to contribute. My friend recommends I should take this as the first step so I decided to give it a try. Can I take this? Thanks. |
@blake2-ppc Are you doing any further work here, or can @wakandan take over removing all traces of Either? |
@jdm still very noob here, but will try my best! |
I won't do anything here. @wakandan can go ahead. I have my concern though that maybe Either is the best thing to keep around for cases like the return value of the two pub functions I listed in my comment previous. Just like it's convenient to return a tuple instead of a custom type, Either is maybe the best choice(?). |
Thanks @blake2-ppc. I was fetching from the upstream of rust but couldn't see your #9180. What am I missing here? |
It was merged, you should see it if you check out new enough
|
@blake2-ppc: I think @brson's intention was to replace such cases with an custom enum type.
|
Yes kimundi, I just mean this
A public API might be easier to use if Either is used as the recurring alternative type, just like tuples are sometimes used instead of creating custom types for each time a pair of values returned. |
@blake2-ppc Hm, I agree in principle, but we'd really need types for two, three, four, ... variants there. Maybe we could define the Either operations as an trait, and add an deriving mode for custom enums? Or just predefine a bunch like with tuples. |
If we want to
and also give them syntax like with tuples, I had an idea for that which I recorded in #8277. Not sure it passes the cost-benefit test, just mentioning. The reason it might be nice is that while there's no trouble defining a bunch of enums like |
@Kimundi ok thanks. |
I tried to remove "either" in mod.rs and rt.rs first, hope it's ok. Got a lot of help from @huonw. Please let me know if there's something I need to pay attention to. Thanks. |
update pull request template Improved suggestion for formatting lint names in the PR template to use this format: [`lint_name`] changelog: none
It's rarely used and usually it's better to define a custom enum type.
The text was updated successfully, but these errors were encountered: