icefoxen / cargo-osha

A Cargo plugin to list unsafe code in a Rust project.
Apache License 2.0
43 stars 3 forks source link

Adjust the way paths and literals are counted #6

Closed dtolnay closed 6 years ago

dtolnay commented 6 years ago

An expression like str::from_utf8_unchecked(bytes) should be counted as one unsafe expression. That is, just str::from_utf8_unchecked and bytes by themselves are not expressions that can meaningfully be considered unsafe. A way to see this is that there would never be a reason to write a function call as:

unsafe { f }(unsafe { x })