-
Notifications
You must be signed in to change notification settings - Fork 1.7k
RefCell<u32>
-> Cell<u32>
#7490
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
Comments
I think this lint would be wrong -- the code might need the |
My thoughts: At least for uses of Now for (Also |
This looks like a duplicate of #1 |
What it does
Suggest using
Cell<T>
instead ofRefCell<T>
, T=u32,i32,f32 ...Categories (optional)
clippy::perf
What is the advantage of the recommended code over the original code
RefCell
will calculate borrow at runtime, soRefCell
has more overhead overCell
RefCell
may panic at runtimeDrawbacks
Maybe some problems in generic type.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: