Skip to content

Commit cb30e76

Browse files
committed
replace funky control flow with something more conventional
1 parent 5f776dd commit cb30e76

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/visudo/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fn edit_sudoers_file(
278278
)
279279
})?;
280280

281-
let true = errors.is_empty() else {
281+
if !errors.is_empty() {
282282
writeln!(stderr, "The provided sudoers file format is not recognized or contains syntax errors. Please review:\n")?;
283283

284284
for crate::sudoers::Error {
@@ -297,9 +297,7 @@ fn edit_sudoers_file(
297297
b'x' => return Ok(()),
298298
_ => continue,
299299
}
300-
};
301-
302-
if sudo_visudo_is_allowed(sudoers, &host_name) == Some(false) {
300+
} else if sudo_visudo_is_allowed(sudoers, &host_name) == Some(false) {
303301
writeln!(
304302
stderr,
305303
"It looks like you have removed your ability to run 'sudo visudo' again.\n"

0 commit comments

Comments
 (0)