rust-lang / rust-lang/rust-clippy
`RefCell<u32>` -> `Cell<u32>`
Open
Nobody has claimed this yet.
A-lint
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
Suggest using Cell<T> instead of RefCell<T>, T=u32,i32,f32 ...
Categories (optional)
clippy::perf
What is the advantage of the recommended code over the original code
RefCellwill calculate borrow at runtime, soRefCellhas more overhead overCellRefCellmay panic at runtime
Drawbacks
Maybe some problems in generic type.
Example
struct S(RefCell<u32>);
Could be written as:
struct S(Cell<u32>);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed RefCell to Cell transformation and the clippy::perf category. Determine which concrete types and generic cases are safe to cover; done means the accepted scope is specified and the corresponding lint behavior is tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100