8000 fix: update some deprecated usages by Topology2333 · Pull Request #2271 · moonbitlang/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: update some deprecated usages #2271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 15, 2025

Conversation

Topology2333
Copy link
Contributor

No description provided.

Copy link
peter-jerry-ye-code-review bot commented Jun 14, 2025
Inconsistent string manipulation across codebase

Category
Maintainability
Code Snippet
From: let bytes = Bytes::of_string("ABC")
To: let bytes = "ABC".to_bytes()
Recommendation
Consider consistently using the method call style (x.method()) rather than the function call style (method(x)) for string operations throughout the codebase.
Reasoning
The changes show a move towards a more object-oriented style with method calls, which improves readability and consistency. This pattern should be applied uniformly across all string manipulation code for better maintainability.

Unicode character representation inconsistency

Category
Correctness
Code Snippet
From: assert_true(Char::default().to_string() == "\x00")
To: assert_true(Char::default().to_string() == "\u0000")
Recommendation
Standardize on using Unicode escape sequences (\uXXXX) for character representations instead of hex escape sequences (\xXX).
Reasoning
Unicode escape sequences are more explicit about their meaning and provide better support for the full Unicode character set. This makes the code more maintainable and less prone to encoding-related bugs.

Deprecated method usage in tests

Category
Maintainability
Code Snippet
inspect(s.get(0), content="H")
inspect(s.charcode_at(0), content="72")
Recommendation
Update all tests to use the new preferred methods (charcode_at, char_at) instead of the deprecated get method.
Reasoning
Using deprecated methods in tests can mask potential issues and makes maintenance more difficult. Tests should use the current preferred APIs to ensure they remain valid and meaningful.

@coveralls
Copy link
Collaborator
coveralls commented Jun 14, 2025

Pull Request Test Coverage Report for Build 7281

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.111%

Totals Coverage Status
Change from base Build 7278: 0.0%
Covered Lines: 8582
Relevant Lines: 9217

💛 - Coveralls

@Topology2333 Topology2333 force-pushed the fix/replace-x-escape branch from 7601519 to d6d3ecd Compare June 14, 2025 16:27
@bobzhang bobzhang merged commit c688996 into moonbitlang:main Jun 15, 2025
10 of 12 checks passed
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.

3 participants
0