menu
redundant-clone
Disallow clones proven unnecessary by ownership and liveness
Cloning an owned value at its final use duplicates the value before the original is discarded. Instead, you SHOULD move the original value when it is not used afterward.
Reported
1import { rc } from "destack:memory";2 3function retain(value: rc.Rc<int32>): rc.Rc<int32> {4 return value.clone();5}Accepted
1import { rc } from "destack:memory";2 3function retain(value: rc.Rc<int32>): rc.Rc<int32> {4 return value;5}