Skip to content

Commit 6ccb646

Browse files
style: fix clippy collapsible_if warnings in reboot/poweroff
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6bb1293 commit 6ccb646

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/steps/os/unix.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,10 +1190,10 @@ pub fn run_atuin(ctx: &ExecutionContext) -> Result<()> {
11901190

11911191
pub fn reboot(ctx: &ExecutionContext) -> Result<()> {
11921192
// Prefer `systemctl reboot` on systemd-based systems
1193-
if Path::new("/run/systemd/system").exists() {
1194-
if let Ok(systemctl) = require("systemctl") {
1195-
return ctx.execute(systemctl).arg("reboot").status_checked();
1196-
}
1193+
if Path::new("/run/systemd/system").exists()
1194+
&& let Ok(systemctl) = require("systemctl")
1195+
{
1196+
return ctx.execute(systemctl).arg("reboot").status_checked();
11971197
}
11981198

11991199
match ctx.sudo() {
@@ -1204,10 +1204,10 @@ pub fn reboot(ctx: &ExecutionContext) -> Result<()> {
12041204

12051205
pub fn poweroff(ctx: &ExecutionContext) -> Result<()> {
12061206
// Prefer `systemctl poweroff` on systemd-based systems
1207-
if Path::new("/run/systemd/system").exists() {
1208-
if let Ok(systemctl) = require("systemctl") {
1209-
return ctx.execute(systemctl).arg("poweroff").status_checked();
1210-
}
1207+
if Path::new("/run/systemd/system").exists()
1208+
&& let Ok(systemctl) = require("systemctl")
1209+
{
1210+
return ctx.execute(systemctl).arg("poweroff").status_checked();
12111211
}
12121212

12131213
match ctx.sudo() {

0 commit comments

Comments
 (0)