-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language teamneeds-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.
Description
Given this pseudocode
let result: bool = Ok(something) == some_function_returning_result();
It should be transformed to this pseudocode
let result: bool = match some_function_returning_result() {
Ok(something) => true,
_ => false,
};
Currently I get this error.
error[E0277]: can't compare `errors::Error` with `errors::Error`
--> src/rustup/toolchain.rs:349:35
|
349 | Ok(something) == some_function_returning_result()
| ^^ no implementation for `errors::Error == errors::Error`
|
= help: the trait `std::cmp::PartialEq` is not implemented for `errors::Error`
= note: required because of the requirements on the impl of `std::cmp::PartialEq` for `std::result::Result<std::string::String, errors::Error>`
It would be nice syntax sugar to have not only for Result
, but for any generic enum.
marcospb19
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language teamneeds-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.