Skip to content

Rust Modernization & Code Quality#134

Merged
M1thieu merged 8 commits intoerematorg:mainfrom
M1thieu:main
Sep 21, 2025
Merged

Rust Modernization & Code Quality#134
M1thieu merged 8 commits intoerematorg:mainfrom
M1thieu:main

Conversation

@M1thieu
Copy link
Collaborator

@M1thieu M1thieu commented Sep 21, 2025

Pull Request

Objective

Update to Rust 2024 edition and improve code maintainability.

Implementation

Rust Modernization

  • Migrated to Rust 2024 Edition with clippy compliance
  • Replaced verbose match expressions with unwrap_or_default()
  • Enhanced error messages with descriptive debugging info
  • Eliminated unnecessary allocations in hot paths
  • Added physics-aware validation and bounds checking

AI System Improvements

  • Reduced code duplication in utility scoring
  • Better modular organization of AI components
  • Streamlined allocation patterns in utility calculations

Architecture

  • Improved Bevy plugin organization and system ordering
  • Maintained domain isolation while enhancing modularity

Testing

All examples run successfully: basic_ai, basic_forces, basic_thermodynamics

cargo build --workspace && cargo check --workspace && cargo test --workspace

Backward compatibility maintained - existing projects work without modification.

Technical Notes

Migration Requirements: None as all changes are backward compatible.

Future Considerations: Physics domains remain isolated for upcoming IRL physics implementation and bevy-mpm integration.

Limitations: Cross-domain integration deferred until physics rules are complete. Still waiting on MPM that I'm making slow progress but still progress, soon physics!

M1thieu added 8 commits August 7, 2025 02:34
- Migrate all 11 crates to Rust 2024 edition
- Fix clippy warnings (unused imports, needless borrows, missing Default)
- Cargo formatting as well along minor typos fixed
- Unique CI cache keys to prevent conflicts
- Should solve future conflicts as well
- Add dynamic linking for faster compile times
- Add SystemSets to ThermodynamicsPlugin for better system ordering
- Add Default impl for AppliedForce component
- Improve system organization following Bevy best practices
• Replace panic-prone Score::set() with robust clamping behavior
• Enhance AI error messages from generic to descriptive debugging info
• Optimize memory allocations via direct iteration over collect() chains
• Modernize pattern matching with unwrap_or_default() and if-let expressions
• Bundle Bevy system registration for improved scheduling performance
• Clean up repetitive documentation patterns
• Add UtilityScore constants (ZERO, HALF, MAX) for common values
• Consolidate repeated error messages in concurrent action systems
• Extract trait value clamping to shared helper function
• Replace magic numbers with named constants for configuration
• Revert Score::set() to maintain compatibility
• Remove external library references from documentation
Forgot to make a cargo check workspace though
@M1thieu M1thieu added the enhancement New feature or request label Sep 21, 2025
@M1thieu M1thieu merged commit ef44dea into erematorg:main Sep 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant