Skip to content

refactor: add #[must_use] to public validate/scan functions across workspace#4974

Merged
bug-ops merged 1 commit into
mainfrom
4943-must-use-sweep
Jun 7, 2026
Merged

refactor: add #[must_use] to public validate/scan functions across workspace#4974
bug-ops merged 1 commit into
mainfrom
4943-must-use-sweep

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Extends the #[must_use] sweep from PR #4939 to cover all remaining public validate-style functions that return non-() values. Without this annotation, callers can silently discard validation errors with no compiler warning.

15 functions annotated across 9 crates:

Crate Function Return type
zeph-config VigilConfig::validate() Result<(), ConfigError>
zeph-config Config::validate() Result<(), ConfigError>
zeph-config entry.rs validate() (×2) Result<(), ConfigError>
zeph-skills SkillRegistry::scan_loaded() Vec<(String, ScanResult)>
zeph-orchestration DependencyGraph::validate() Result<(), OrchestrationError>
zeph-orchestration validate_verify_config() Result<(), _>
zeph-experiments EvalCase::validate() Result<(), EvalError>
zeph-common MemoryConfig::validate() Result<(), String>
zeph-core QualityConfig::validate() Result<(), QualityConfigError>
zeph-mcp validate_command() Result<(), _>
zeph-mcp validate_env() Result<(), _>
zeph-plugins validate_url_scheme_ephemeral() Result<(), _>
zeph-tools validate_sandbox_denied_domains() Result<(), String>
zeph-tools validate_domain_patterns() Result<(), String>

Note: SkillRegistry::body() (returning Result<&str, SkillError>) was intentionally skipped — Result is already #[must_use] in Rust stdlib, and adding a bare #[must_use] attribute triggers clippy::double_must_use under -D warnings.

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace -- -D warnings — 0 warnings
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --lib --bins — 10657 passed
  • RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler" — clean
  • Zero functional changes — purely additive attribute annotations

Closes #4943
Closes #4961
Closes #4963

…rkspace

Extends the #[must_use] sweep from PR #4939 to cover all remaining
public validate-style functions that return non-() values. Annotated
15 functions across 9 crates:

- zeph-config: VigilConfig::validate, Config::validate, two entry.rs validate()
- zeph-skills: SkillRegistry::scan_loaded (body() skipped — Result already #[must_use])
- zeph-orchestration: DependencyGraph::validate, validate_verify_config
- zeph-experiments: EvalCase::validate
- zeph-common: MemoryConfig::validate
- zeph-core: QualityConfig::validate
- zeph-mcp: validate_command, validate_env
- zeph-plugins: validate_url_scheme_ephemeral
- zeph-tools: validate_sandbox_denied_domains, validate_domain_patterns

Closes #4943, #4961, #4963
@github-actions github-actions Bot added documentation Improvements or additions to documentation skills zeph-skills crate refactor Code refactoring without functional changes rust Rust code changes core zeph-core crate size/S Small PR (11-50 lines) labels Jun 7, 2026
@bug-ops
bug-ops enabled auto-merge (squash) June 7, 2026 10:33
@bug-ops
bug-ops merged commit 850452f into main Jun 7, 2026
32 checks passed
@bug-ops
bug-ops deleted the 4943-must-use-sweep branch June 7, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation refactor Code refactoring without functional changes rust Rust code changes size/S Small PR (11-50 lines) skills zeph-skills crate

Projects

None yet

1 participant