Skip to content

refactor: fix unwrap panics, optimize string formatting, and update README#213

Open
Cylae wants to merge 1 commit intomainfrom
fix-unwrap-fmt-optimizations-15140561039869505128
Open

refactor: fix unwrap panics, optimize string formatting, and update README#213
Cylae wants to merge 1 commit intomainfrom
fix-unwrap-fmt-optimizations-15140561039869505128

Conversation

@Cylae
Copy link
Owner

@Cylae Cylae commented Mar 8, 2026

This PR addresses safety improvements, code optimizations, and documentation updates across the codebase:

  1. Safety Fixes:

    • Replaced .unwrap() on Mutex locks with .unwrap_or_else(|poisoned| poisoned.into_inner()) in web.rs to prevent panics in case of thread poisoning.
    • Removed unsafe .unwrap() calls in the users.rs test suite, properly checking results via is_ok() and if let Some().
  2. Optimizations:

    • Refactored push_str(&format!(...)) patterns in cli.rs and infra.rs to use std::fmt::Write::write_fmt directly on the mutable string, avoiding intermediate allocations.
  3. Documentation:

    • Updated the "Services and Ports List" in README.md (both English and French sections) to properly include Gitea's external SSH port 2222.

All tests have been run and pass successfully. The codebase has been verified with cargo fmt and cargo clippy.


PR created automatically by Jules for task 15140561039869505128 started by @Cylae

- Removed panicking `unwrap()` calls on Mutex locks in `server_manager/src/interface/web.rs`
- Handled Option returns properly without unwrapping in `server_manager/src/core/users.rs` tests
- Optimized string formatting in `server_manager/src/interface/cli.rs` and `server_manager/src/services/infra.rs` by replacing `push_str(&format!(...))` with `std::fmt::Write::write_fmt`
- Updated `README.md` to document Gitea SSH port (2222) in the Services and Ports Matrix
- Ran `cargo fmt` and `cargo clippy`
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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