Skip to content

Improve unsafe comments/documentation/encapsulation #109

@itsjunetime

Description

@itsjunetime

As I've been poking through the code of this library recently, I've noticed that there are a lot of undocumented unsafe fns and blocks. I'd like to go through and improve documentation and encapsulation for a lot of these areas, if that's alright.

The specific steps that I feel could help with this a lot:

  • Apply the unsafe_op_in_unsafe_fn, clippy::multiple_unsafe_ops_per_block, and clippy::undocumented_unsafe_blocks lints in the Cargo.toml (and fix what they warn)
  • Replace a lot of the inner: *mut _ fields with inner: NonNull<_> instead to ensure the inner ptrs aren't null when we dereference them
  • Add utility fns that utilize NonNull::as_ref to get valid references to inner (for a lot of these wrapping structs) to avoid needing an unsafe block per-function

Do these all sound like reasonable steps? Would you accept PRs that take these steps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    qualityImprove the quality of the code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions