Skip to content

chore: use is_some_and for file ext check #8

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

Merged
merged 1 commit into from
Jan 13, 2025
Merged

chore: use is_some_and for file ext check #8

merged 1 commit into from
Jan 13, 2025

Conversation

chenrui333
Copy link
Contributor

@chenrui333 chenrui333 commented Jan 12, 2025

error: this `map_or` is redundant
  --> src/project.rs:32:20
   |
32 |                 if path.extension().map_or(false, |ext| ext == "tf")
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `path.extension().is_some_and(|ext| ext == "tf")`
   |

for #6 and #7

```
error: this `map_or` is redundant
  --> src/project.rs:32:20
   |
32 |                 if path.extension().map_or(false, |ext| ext == "tf")
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `path.extension().is_some_and(|ext| ext == "tf")`
   |
```

Signed-off-by: Rui Chen <[email protected]>
@nwiizo nwiizo merged commit 36cce1f into nwiizo:main Jan 13, 2025
1 check passed
@nwiizo
Copy link
Owner

nwiizo commented Jan 13, 2025

Thank you for the contribution! This change to use is_some_and for the file extension check improves the code quality by following Rust's best practices. Much appreciated! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants