Skip to content

Commit 88b777d

Browse files
Merge pull request #1981 from tottoto/simplify-conditional-expression
chore: simplify conditional expression
2 parents 640c2c1 + ec03259 commit 88b777d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/volta-core/src/project/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl Project {
174174
// (project uses Yarn berry if 'yarnrc.yml' exists, uses PnP if '.pnp.js' or '.pnp.cjs' exist)
175175
pub fn needs_yarn_run(&self) -> bool {
176176
self.platform()
177-
.map_or(false, |platform| platform.yarn.is_some())
177+
.is_some_and(|platform| platform.yarn.is_some())
178178
&& self.workspace_roots().any(|x| {
179179
x.join(".yarnrc.yml").exists()
180180
|| x.join(".pnp.cjs").exists()
@@ -251,11 +251,11 @@ fn is_node_root(dir: &Path) -> bool {
251251
}
252252

253253
fn is_node_modules(dir: &Path) -> bool {
254-
dir.file_name().map_or(false, |tail| tail == "node_modules")
254+
dir.file_name().is_some_and(|tail| tail == "node_modules")
255255
}
256256

257257
fn is_dependency(dir: &Path) -> bool {
258-
dir.parent().map_or(false, is_node_modules)
258+
dir.parent().is_some_and(is_node_modules)
259259
}
260260

261261
fn is_project_root(dir: &Path) -> bool {

src/volta-migrate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn main() {
1010
// In order to migrate the existing Volta directory while avoiding unconditional changes to the user's system,
1111
// the Homebrew formula runs volta-migrate with `--no-create` flag in the post-install phase.
1212
let no_create = matches!(std::env::args_os().nth(1), Some(flag) if flag == "--no-create");
13-
if no_create && !volta_home().map_or(false, |home| home.root().exists()) {
13+
if no_create && volta_home().map_or(true, |home| !home.root().exists()) {
1414
ExitCode::Success.exit();
1515
}
1616

0 commit comments

Comments
 (0)