Skip to content

Conversation

@anakrish
Copy link
Collaborator

  • Made the lookup module crate-visible to address clippy’s redundant visibility lint.
  • Replaced unchecked as casts with a fallible usize_from_u32 helper and propagate conversion errors in lookup accessors.
  • Switched LookupIndexError to implement core::error::Error for no_std correctness.
  • Fixed the pattern type mismatch by matching on the value in the Display impl.
  • Promoted trivial helpers to const fn (new, module_len) per clippy suggestions.
  • Centralized bounds-checked slot access via slot_ref/slot_mut to keep getters/clearers lint-clean and avoid unchecked indexing.

- Made the lookup module crate-visible to address clippy’s redundant visibility lint.
- Replaced unchecked as casts with a fallible usize_from_u32 helper and propagate conversion errors in lookup accessors.
- Switched LookupIndexError to implement core::error::Error for no_std correctness.
- Fixed the pattern type mismatch by matching on the value in the Display impl.
- Promoted trivial helpers to const fn (new, module_len) per clippy suggestions.
- Centralized bounds-checked slot access via slot_ref/slot_mut to keep getters/clearers lint-clean and avoid unchecked indexing.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses clippy lint errors in the lookup module by improving type safety, error handling, and code quality without changing the module's external behavior.

Key changes:

  • Replaced unsafe as casts with checked try_from conversions and proper error propagation
  • Changed from std::error::Error to core::error::Error for no_std compatibility
  • Improved API encapsulation by making the lookup module and its methods crate-visible

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/lookup.rs Removed clippy allow directives; added fallible usize conversion helper; changed visibility to pub(crate); promoted trivial functions to const fn; improved bounds checking with new slot_ref/slot_mut helpers; fixed Display impl pattern matching
src/lib.rs Changed lookup module visibility from private to pub(crate) to match the module's intended scope

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant