986 B
986 B
Rust Style
The small conventions this tree keeps in its Rust.
- Use
if matches!(expr, Variant)instead ofif let Some(Variant) = exprfor enum variant matching - Use
if let Some(x) = exprinstead ofif let Some(Some(x)) = expr— drop unnecessary nesting - Prefer explicit
matchoverunwrap_or_default()for clarity - Use
unwrap_or_else(|| expr)for lazy defaults,unwrap_or(val)for eager defaults - Use
anyhow!()with context strings that include identifying info (e.g. UUID, title) not bare values - A command whose arguments run past a handful takes a clap
Argsstruct, not an inline variant with a matching parameter list:AddArgs,SetArgs,AppendArgs,CheckArgs,MvArgs.addwas nine positional parameters threaded frommainbefore it becameAddArgs, and the handler destructures the struct so the body reads the same as before.mvwas the last inline variant to carry an--actor, and--actor-from-gitpushed its list past the line