Skip to content

style/format-code: reduce code nesting#1043

Open
Tellcts wants to merge 1 commit into
TheAlgorithms:masterfrom
Tellcts:style/format-code
Open

style/format-code: reduce code nesting#1043
Tellcts wants to merge 1 commit into
TheAlgorithms:masterfrom
Tellcts:style/format-code

Conversation

@Tellcts
Copy link
Copy Markdown

@Tellcts Tellcts commented Jun 2, 2026

Description

  1. Reduced the multiple layers of nesting in match, making the code appear flatter;
  2. Remove the explicit import of Deref and fully leverage the compiler's implicit dereferencing behavior;
  3. Optimize code logic.

Type of change

  • Optimization of code structure

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

Please make sure that if there is a test that takes too long to run ( > 300ms), you #[ignore] that or
try to optimize your code or make the test easier to run. We have this rule because we have hundreds of
tests to run; If each one of them took 300ms, we would have to wait for a long time.

@Tellcts Tellcts requested a review from imp2002 as a code owner June 2, 2026 09:13
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.83%. Comparing base (7789289) to head (e1260e5).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1043   +/-   ##
=======================================
  Coverage   95.82%   95.83%           
=======================================
  Files         393      393           
  Lines       29971    29977    +6     
=======================================
+ Hits        28721    28729    +8     
+ Misses       1250     1248    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Author

@Tellcts Tellcts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have review my codes and impove the test coverage.

@Tellcts Tellcts force-pushed the style/format-code branch from 67963d7 to e1260e5 Compare June 3, 2026 07:17
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.

2 participants