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

Replace usages of map_or(bool, ...) with is_{some_and|none_or|ok_and} #135732

Closed
wants to merge 1 commit into from

Conversation

yotamofek
Copy link
Contributor

The usage of map_or(bool, ...) is really hard to understand IMHO.
This PR simply uses clippy (with --fix) to replace that with is_{some_and|none_or|ok_and}.
(no manual modifications were made, just machine applicable clippy fixes and then fmt)

@rustbot
Copy link
Collaborator

rustbot commented Jan 19, 2025

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jan 19, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 19, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in coverage instrumentation.

cc @Zalathar

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Please do not open PRs that apply clippy lints widely to all tools, standard library, and compiler. It makes it difficult to review, since different reviewers should and should not be approving changes to different parts of the compiler. If you'd like to, please split this into separate PRs for compiler/library/tidy.

@compiler-errors
Copy link
Member

Feel free to assign me the compiler PR, but for now I'm gonna close this.

@yotamofek
Copy link
Contributor Author

Will do, thanks and sorry for the noise. 🙏

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 19, 2025
…compiler-errors

Replace usages of `map_or(bool, ...)` with `is_{some_and|none_or|ok_and}`

Split out from rust-lang#135732 according to rust-lang#135732 ,
same thing but just for the compiler:

> The usage of `map_or(bool, ...)` is really hard to understand IMHO.
> This PR simply uses clippy (with `--fix`) to replace that with `is_{some_and|none_or|ok_and}`.
> (no manual modifications were made, just machine applicable clippy fixes and then fmt)

r? `@compiler-errors`
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Jan 20, 2025
…compiler-errors

Replace usages of `map_or(bool, ...)` with `is_{some_and|none_or|ok_and}`

Split out from rust-lang#135732 according to rust-lang#135732 ,
same thing but just for the compiler:

> The usage of `map_or(bool, ...)` is really hard to understand IMHO.
> This PR simply uses clippy (with `--fix`) to replace that with `is_{some_and|none_or|ok_and}`.
> (no manual modifications were made, just machine applicable clippy fixes and then fmt)

r? ``@compiler-errors``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2025
Rollup merge of rust-lang#135738 - yotamofek:map_or_true-compiler, r=compiler-errors

Replace usages of `map_or(bool, ...)` with `is_{some_and|none_or|ok_and}`

Split out from rust-lang#135732 according to rust-lang#135732 ,
same thing but just for the compiler:

> The usage of `map_or(bool, ...)` is really hard to understand IMHO.
> This PR simply uses clippy (with `--fix`) to replace that with `is_{some_and|none_or|ok_and}`.
> (no manual modifications were made, just machine applicable clippy fixes and then fmt)

r? ``@compiler-errors``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants