-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Next/20210823/v4 #6304
Merged
Merged
Next/20210823/v4 #6304
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
All cases of our transmute can be replaced with more idiomatic solutions and do no require the power of transmute. When returning an object to C for life-time management, use Box::into_raw to convert the boxed object to pointer and use Box::from_raw to convert back. For cases where we're just returning a pointer to Rust managed data, use a cast.
Based on the Rust clippy lint that recommends that any public function that dereferences a raw pointer, mark all FFI functions that reference raw pointers with build_slice and cast_pointer as unsafe. This commits starts by removing the unsafe wrapper inside the build_slice and cast_pointer macros then marks all functions that use these macros as unsafe. Then fix all not_unsafe_ptr_arg_deref warnings from clippy. Fixes clippy lint: https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
These are needless borrows (references) as the item is already a reference.
This lint checks for a closure where a function can be directly supplied. Runtime performance is unchanged, but this makes less work for the compiler.
Calling a function in unwrap_or causes that function to always be called even when not needed. Instead use unwrap_or_else with a closure which will only be called when needed.
In these simple cases to_string() is recommended and likely performs better as the formatter is not called.
These add complexity and may not be optimized out by the compiler.
This is a readability fix, as on first look they almost look like a Rust tuple.
This is code that is not needed and is a bit confusing to see.
When defaulting checked_mul to u64::max, Rust has a method that does the same thing called saturating_mul.
- ref is discouraged for top level variables - the other borrow is not required
This is the preffered style and easier to understand the meaning of the code.
Using `if let` expressions in these cases is better expressed by the map method, and considered idiomatic Rust for this usage.
Suppress all remaining clippy lints that we trip. This can be fixed on a per-lint basis.
Codecov Report
@@ Coverage Diff @@
## master #6304 +/- ##
=======================================
Coverage 76.94% 76.94%
=======================================
Files 611 611
Lines 185941 185941
=======================================
+ Hits 143064 143081 +17
+ Misses 42877 42860 -17
Flags with carried forward coverage won't be shown. Click here to find out more. |
CIFuzz compile failure:
|
This was referenced Aug 23, 2021
CIFuzz failure is due to oss-fuzz build failure due to a regression in rust nightly rust-lang/rust#53945 |
I meant rust-lang/rust#88258 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#6283 #6303 #6290 #6286