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

Clean up library with is_non_null #1528

Merged

Conversation

workingjubilee
Copy link
Member

This adds PointerExt::is_non_null and cleans up some of the list code. I am told this is more readable?

@nyurik
Copy link
Contributor

nyurik commented Feb 5, 2024

Definitely! I will remove all != null from the #1523

Copy link
Contributor

@NotGyro NotGyro left a comment

Choose a reason for hiding this comment

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

This does seem clearer. Particularly, null_mut could be misunderstood as some mutable null - for example, if a C programmer in a hurry thought it was equivalent to a void*.

is_non_null() has none of that ambiguity, and seems much better to me. This change looks good.

@nyurik
Copy link
Contributor

nyurik commented Feb 5, 2024

I searched for is_non_null and is_not_null in the rust codebase - seems the is_not_null is mentioned more frequently - i think that would be a better "more obvious" choice.

@workingjubilee workingjubilee changed the title Clean up list null checks Replace != null() by is_non_null Feb 5, 2024
@nyurik
Copy link
Contributor

nyurik commented Feb 5, 2024

(i was trying to figure out why it wasn't in the core already - apparently there are some discussions about *T and Option<NonNull<*T>> and similar

@workingjubilee workingjubilee changed the title Replace != null() by is_non_null Clean up library with is_non_null Feb 5, 2024
@workingjubilee
Copy link
Member Author

🚲 🏚️ 🖌️

@workingjubilee workingjubilee merged commit 0e01d93 into pgcentralfoundation:develop Feb 5, 2024
8 checks passed
@workingjubilee workingjubilee deleted the add-pointer-ext branch February 5, 2024 22:29
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.

3 participants