Skip to content

chore(volo-build): fix clippy warning unnecessary_map_or#536

Merged
yukiiiteru merged 1 commit intocloudwego:mainfrom
yukiiiteru:chore/fix-clippy
Nov 18, 2024
Merged

chore(volo-build): fix clippy warning unnecessary_map_or#536
yukiiiteru merged 1 commit intocloudwego:mainfrom
yukiiiteru:chore/fix-clippy

Conversation

@yukiiiteru
Copy link
Copy Markdown
Contributor

Motivation

Fix clippy warning unnecessary_map_or

error: this `map_or` is redundant
   --> volo-build/src/util.rs:313:16
    |
313 |             if repo.workdir().map_or(false, |workdir| workdir == path) {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(repo.workdir() == Some(path))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `-D clippy::unnecessary-map-or` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`

Solution

Fix it

```
error: this `map_or` is redundant
   --> volo-build/src/util.rs:313:16
    |
313 |             if repo.workdir().map_or(false, |workdir| workdir == path) {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(repo.workdir() == Some(path))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `-D clippy::unnecessary-map-or` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`
```

Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
@yukiiiteru yukiiiteru requested review from a team as code owners November 18, 2024 11:45
@yukiiiteru yukiiiteru merged commit 2479fd7 into cloudwego:main Nov 18, 2024
@yukiiiteru yukiiiteru deleted the chore/fix-clippy branch November 18, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants