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

Replace uses of unsafe with safe alternatives #1714

Merged
merged 7 commits into from
May 5, 2024

Conversation

nabilwadih
Copy link
Contributor

@nabilwadih nabilwadih commented Dec 4, 2023

Some of the usages of unsafe in the codebase can now be replaced with safe functions from the rust standard library. This PR updates those to remove the unsafe blocks

Verified that all of the tests are still passing.

@nabilwadih nabilwadih requested a review from Geal as a code owner December 4, 2023 20:28
@Geal
Copy link
Collaborator

Geal commented Apr 21, 2024

these unsafe calls are there to avoid paying anohter bounds check (and for &str a is_char_boundary check) while code outside is already supposed to guarantee it

src/lib.rs Outdated Show resolved Hide resolved
Copy link

codspeed-hq bot commented May 5, 2024

CodSpeed Performance Report

Merging #1714 will not alter performance

Comparing nabilwadih:nwadih/removeUnsafe (5ec2746) with main (cdd8baf)

Summary

✅ 24 untouched benchmarks

Copy link

codecov bot commented May 5, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 62.01%. Comparing base (cdd8baf) to head (5ec2746).

Files Patch % Lines
src/traits.rs 80.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1714      +/-   ##
==========================================
- Coverage   62.01%   62.01%   -0.01%     
==========================================
  Files          24       24              
  Lines        2912     2917       +5     
==========================================
+ Hits         1806     1809       +3     
- Misses       1106     1108       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@Geal Geal left a comment

Choose a reason for hiding this comment

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

running the benchmarks again, this has no noticeable impact, so this will be ok

@Geal Geal merged commit 82b09f0 into rust-bakery:main May 5, 2024
18 checks passed
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