Skip to content

refactor: flatten nested match for user lookup#6

Open
LudWittg wants to merge 1 commit intoDcodingTheWeb:masterfrom
LudWittg:patch-1
Open

refactor: flatten nested match for user lookup#6
LudWittg wants to merge 1 commit intoDcodingTheWeb:masterfrom
LudWittg:patch-1

Conversation

@LudWittg
Copy link

Refactored the nested match for the getpwnam result into a single match block using Ok(Some(x)) and Ok(None). The functionality remains 100% identical. This just improves readability/makes the code more concise.

Copy link
Member

@TheDcoder TheDcoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, should be good for merge once the indentation is fixed.

Comment on lines +97 to +99
Err(_) => print_error_and_exit("Failed to retrieve target user", 1),
Ok(None) => print_error_and_exit("Target user does not exist", 1),
Ok(Some(x)) => x,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation, the whole project uses hard tabs instead of spaces (soft tabs), in hindsight I should've included an .rustfmt.toml file in the root.

@TheDcoder TheDcoder self-assigned this Mar 16, 2026
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