rust-lang / rust-lang/rust-clippy
References within Rc/Arc may not be meaningful
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
The reference to Sized within Rc/Arc may not make sense,
consider moving the value into Arc?
Advantage
- Perhaps unnecessary Arc can be avoided
Drawbacks
No response
Example
use std::{rc::Rc, sync::Arc};
fn main() {
let n = 2;
let mut m = 3;
let _x = Arc::new(&n);
let _y = Rc::new(&mut m);
}
Could be written as:
use std::{rc::Rc, sync::Arc};
fn main() {
let n = 2;
let mut m = 3;
let _x = Arc::new(n);
let _y = Rc::new(m);
}
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 by examining the Rc and Arc examples in the issue and determine what behavior is proposed for references to Sized values. Clarify whether the intended result is a new lint and what conditions would make moving the value into Rc or Arc safe and complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100