Skip to content
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

enum CompInterType: make a real enum #869

Merged
merged 3 commits into from
Mar 21, 2024
Merged

enum CompInterType: make a real enum #869

merged 3 commits into from
Mar 21, 2024

Conversation

folkertdev
Copy link
Collaborator

this PR looks big but most lines are because I needed to reverse two branches so that

if comp_type.is_none() { ... } else { ... }

can turn into

if let Some(comp_type) = comp_type { ... }  else { ... }

the first commit is most changes, the second one just the switching of branches and using the variable bound by the if-let

Copy link
Collaborator

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

Still reviewing the second commit.

src/levels.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

The 2nd commit is too annoying to review. It's just the if let Some and swapping the branches' order, right? If that's it, it LGTM.

@folkertdev
Copy link
Collaborator Author

yes, that and it removes these lines

// TODO use if let in the surrounding if structure
let comp_inter_type = b.c2rust_unnamed.c2rust_unnamed_0.comp_type.unwrap();

because that variable is now bound by the if let

@kkysen kkysen merged commit 606bb8f into main Mar 21, 2024
36 checks passed
@kkysen kkysen deleted the comp-inter-type-enum branch March 21, 2024 21:42
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