← Rule catalog

rust-doctor · Error Handling

box-dyn-error-in-public-api

Flags `pub fn` returning `Result<_, Box<dyn Error>>`. This erases error type information, making it impossible for callers to match on specific error variants.

Severity
warning
Confidence
medium
Analyzer
syn-ast
Default policy
Enabled

Tags

  • error-handling
  • heuristic

Framework requirements

No framework requirement.

Limitations

  • Syntactic analysis does not have rustc name resolution or inferred type information.

Remediation

Define a custom error enum with `thiserror` or return a concrete error type.

Fix capability: guidance