Neptune-Crypto/neptune-core

style: Prefer references to `cli_args::Args`

開放

#532 建立於 2025年3月27日

 (0 則留言) (1 個反應) (0 位負責人)Rust (45 個分叉)auto 404
choregood first issuelow priority

倉庫指標

星標
 (110 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Some test helper setup functions take a reference to cli_args::Args and others take ownership of an object. The latter type generates more boilerplate due to excessive .clone().

The intention behind cli_args::Args is that once set, they never change. (If there is a transgression against this principle anywhere, we need to fix that.) So cloning in order to pass ownership of an object that's not going to change anyway is moot in addition to boilerplatey. Let's prefer references instead.

I do think one exception is necessary. We want one copy of the CLI arguments to live on global state. And we do not want to bother keeping track of lifetimes there. So we clone it once, when constructing global state.

Most of this task boils down to fixing function interfaces in tests and red squiggly lines that result from there.

貢獻者指南