Skip to content

Commit 040a372

Browse files
committed
Reject Arc.clone() syntax in favor of Arc::clone
`arc.clone()` leaves the code somewhat ambiguous to whether we're doing an expensive deep-clone operation or if we're doing a (relatively) cheap pointer-copy-and-atomic-increment operation. More importantly, it leaves entirely unclear what the semantics of the object we just created are - does updating it update the original or leave it be? Thus, here we require `Arc::clone` via clippy enforcement in CI
1 parent ae51f25 commit 040a372

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ci/check-lint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
set -e
33
set -x
44
RUSTFLAGS='-D warnings' cargo clippy -- \
5+
`# Things clippy defaults to allowing but we should avoid` \
6+
-D clippy::clone_on_ref_ptr \
57
`# Things where clippy is just wrong` \
68
-A clippy::unwrap-or-default \
79
`# Errors` \

0 commit comments

Comments
 (0)