Skip to content

Commit

Permalink
chore(volo-build): fix clippy warning unnecessary_map_or (#536)
Browse files Browse the repository at this point in the history
```
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 <[email protected]>
  • Loading branch information
yukiiiteru authored Nov 18, 2024
1 parent 2856932 commit 2479fd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion volo-build/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ pub fn git_repo_init(path: &Path) -> anyhow::Result<()> {
fn in_git_repo(path: &Path) -> bool {
if let Ok(repo) = git2::Repository::discover(path) {
// Don't check if the working directory itself is ignored.
if repo.workdir().map_or(false, |workdir| workdir == path) {
if repo.workdir() == Some(path) {
true
} else {
!repo.is_path_ignored(path).unwrap_or(false)
Expand Down

0 comments on commit 2479fd7

Please sign in to comment.