Skip to content

fix: clippy ok_or, const-fold string alloc, errors: Option<CompileError>#9

Merged
danieljohnmorris merged 1 commit into
mainfrom
fix/medium-issues
Feb 26, 2026
Merged

fix: clippy ok_or, const-fold string alloc, errors: Option<CompileError>#9
danieljohnmorris merged 1 commit into
mainfrom
fix/medium-issues

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • ok_or_elseok_or for non-lazy struct construction (fixes clippy warning)
  • Compiler const-fold for string + now uses String::with_capacity + push_str instead of format!, consistent with the VM dispatch path fixed in PR perf: pre-size string concatenation with String::with_capacity #6
  • errors: Vec<CompileError>first_error: Option<CompileError>: Vec implied multi-error accumulation but compile_program always returned only the first; Option correctly models the intent

Test plan

  • All 13 tests pass
  • cargo clippy reports zero warnings

- Replace ok_or_else with ok_or for non-lazy VmError construction (clippy)
- Const-fold string Add now uses String::with_capacity + push_str
  instead of format! (two allocations → one), consistent with VM dispatch
- Replace errors: Vec<CompileError> with first_error: Option<CompileError>;
  Vec implied multi-error accumulation but only the first was ever returned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant