+
Skip to content

Conversation

siketyan
Copy link
Member

@siketyan siketyan commented Aug 10, 2025

Summary

Upgraded to the Rust toolchain v1.89.0 and fixed lint warnings.

Test Plan

Existing tests should pass.

Docs

N/A

@siketyan siketyan requested review from a team August 10, 2025 07:06
@siketyan siketyan self-assigned this Aug 10, 2025
Copy link

changeset-bot bot commented Aug 10, 2025

⚠️ No Changeset found

Latest commit: 5e5b4f0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Aug 10, 2025

Walkthrough

This update introduces explicit lifetime annotations to a wide range of function and method return types across the codebase, particularly for types such as Cow, iterators, and custom structs. The changes affect public APIs, trait implementations, and internal functions, making the borrowing semantics more explicit and aligning with Rust's evolving best practices. Additionally, the Rust toolchain and Docker images have been updated from version 1.88.0 to 1.89.0 in configuration files and CI workflows. One deprecated struct was removed, and minor trait derivations were adjusted. No substantial logic or control flow changes are present.

Suggested reviewers

  • ematipico

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6af441 and 5e5b4f0.

📒 Files selected for processing (1)
  • Dockerfile.benchmark (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dockerfile.benchmark
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (26)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Test Node.js API
  • GitHub Check: Parser conformance
  • GitHub Check: autofix
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added A-CLI Area: CLI A-Core Area: core A-Project Area: project A-Linter Area: linter A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS L-JSON Language: JSON and super languages A-Diagnostic Area: diagnostocis L-HTML Language: HTML L-Grit Language: GritQL A-Type-Inference Area: type inference A-Resolver Area: resolver labels Aug 10, 2025
Copy link

codspeed-hq bot commented Aug 10, 2025

CodSpeed Performance Report

Merging #7170 will degrade performances by 8.72%

Comparing siketyan:build/rust-1.89 (5e5b4f0) with main (7424b9a)

Summary

❌ 2 (👁 2) regressions
✅ 126 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
👁 versions[0.3.533] 2.3 µs 2.6 µs -8.62%
👁 versions[2.3.533] 2.3 µs 2.5 µs -8.72%

@github-actions github-actions bot removed A-LSP Area: language server protocol A-Diagnostic Area: diagnostocis labels Aug 10, 2025
@github-actions github-actions bot removed the A-Resolver Area: resolver label Aug 10, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
crates/biome_grit_patterns/src/grit_built_in_functions.rs (1)

580-588: Make capitalise Unicode-aware (not just ASCII)

to_ascii_uppercase won’t handle non-ASCII letters (e.g. é, ß). Prefer Unicode uppercasing of the first char; keep the borrowed fast-path:

-fn capitalize(s: &str) -> Cow<'_, str> {
-    if let Some(first_char) = s.chars().next()
-        && !first_char.is_uppercase()
-    {
-        let rest = &s[first_char.len_utf8()..];
-        return Cow::Owned(first_char.to_ascii_uppercase().to_string() + rest);
-    }
-    Cow::Borrowed(s)
-}
+fn capitalize(s: &str) -> Cow<'_, str> {
+    let mut chars = s.chars();
+    let Some(first) = chars.next() else {
+        return Cow::Borrowed(s);
+    };
+    if first.is_uppercase() {
+        return Cow::Borrowed(s);
+    }
+    let mut owned = first.to_uppercase().to_string(); // may be multi-char
+    owned.push_str(chars.as_str());
+    Cow::Owned(owned)
+}

Consider adding tests for non-ASCII input to lock behaviour.

Would you like me to add a small test matrix (e.g. "éclair"→"Éclair", "straße"→"Straße", "ß..."→"SS..." depending on desired mapping)?

🧹 Nitpick comments (9)
crates/biome_string_case/src/lib.rs (2)

648-648: Explicit lifetime on Cow clarifies borrowing; no behaviour change

Good call switching to Cow<'_, Self>; this matches rustc/clippy expectations on elided lifetimes in type paths and keeps the API semantics intact.

Tiny nit in the doc just above: “this functions returns” → “this function returns”.


661-661: Same here: lifetime made explicit on Cow

Consistent with the previous trait; this silences the elided-lifetime lint and is semantically equivalent to the former signature.

Doc nit: “this functions returns” → “this function returns”.

rust-toolchain.toml (1)

5-5: Toolchain bump looks good.

Channel pinned to 1.89.0 is consistent with CI updates. Ensure you run just f to reformat TOML as per repo guidelines.

.github/workflows/release.yml (1)

185-185: Pinned Rust 1.89.0-bullseye digest looks consistent.

GNU builds keep bullseye for older glibc—good call. Consider adding a brief comment next to the image pin on how to refresh digests, to keep future bumps smooth.

crates/biome_grit_patterns/src/grit_node.rs (1)

75-75: Optional: avoid allocation if TokenText can be borrowed

If TokenText exposes as_str() (or Deref<Target = str>), you can return a borrowed slice and skip allocating:

  • Use Ok(Cow::Borrowed(self.0.text_trimmed().as_str())).

If not available, feel free to ignore.

crates/biome_service/src/settings.rs (1)

198-216: Cow lifetimes tied to &self are appropriate here

  • The explicit '_' makes it clear when we return borrowed config vs materialise an owned copy via to_mut(). The merge paths for rules/domains/actions remain correct.
  • get_plugins_for_path/as_all_plugins correctly switch to Owned only when needed and extend without altering the base config.

If you fancy a micro-optimisation later: consider deduping plugins when multiple overrides add the same entries. Not urgent for this PR.

Also applies to: 220-238, 242-259, 263-272, 276-290

crates/biome_grit_patterns/src/grit_target_node.rs (1)

381-383: Prefer disambiguation to avoid method-name shadowing confusion

Inside the trait impl, calling self.text() resolves to the inherent method here, but it’s easy to misread as recursive. Consider fully qualifying the inherent call.

-        Ok(Cow::Borrowed(self.text()))
+        Ok(Cow::Borrowed(GritTargetNode::text(self)))
crates/biome_grit_formatter/src/verbatim.rs (1)

154-154: Quick sanity check: naming looks off in this crate

This is grit, but the type is FormatGraphqlVerbatimNode and functions are “graphql”/“bogus”/“suppressed”. Intentional cross-crate reuse, or leftover naming?

crates/biome_module_graph/src/js_module_info/module_resolver.rs (1)

404-409: Cow<'_, TypeData> return is appropriate

Currently always returns Owned, which is fine and explicit. If you ever expose a borrowed variant from ResolvedTypeData, this could avoid allocations, but not required for this PR.

@siketyan siketyan merged commit bed6492 into biomejs:main Aug 10, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Core Area: core A-Formatter Area: formatter A-Linter Area: linter A-Parser Area: parser A-Project Area: project A-Tooling Area: internal tools A-Type-Inference Area: type inference L-CSS Language: CSS L-Grit Language: GritQL L-HTML Language: HTML L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载