Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

Comments

The scope of the unsafe block can be appropriately reduced#50

Open
cactter wants to merge 1 commit intoweihanglo:masterfrom
cactter:master
Open

The scope of the unsafe block can be appropriately reduced#50
cactter wants to merge 1 commit intoweihanglo:masterfrom
cactter:master

Conversation

@cactter
Copy link

@cactter cactter commented Jul 22, 2022

In this function you use the unsafe keyword for some safe expressions.

We need to mark unsafe operations more precisely using unsafe keyword. Keeping unsafe blocks small can bring many benefits. For example, when mistakes happen, we can locate any errors related to memory safety within an unsafe block. This is the balance between Safe and Unsafe Rust. The separation is designed to make using Safe Rust as ergonomic as possible, but requires extra effort and care when writing Unsafe Rust.

Hope this PR can help you.
Best regards.
References
https://doc.rust-lang.org/nomicon/safe-unsafe-meaning.html
https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

@weihanglo
Copy link
Owner

Thank you! Could you help format the code?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants