-
-
Notifications
You must be signed in to change notification settings - Fork 720
build: upgrade to Rust 1.89 #7170
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
Conversation
|
WalkthroughThis update introduces explicit lifetime annotations to a wide range of function and method return types across the codebase, particularly for types such as Suggested reviewers
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 detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
CodSpeed Performance ReportMerging #7170 will degrade performances by 8.72%Comparing Summary
Benchmarks breakdown
|
0a362a4
to
b6af441
Compare
There was a problem hiding this 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 changeGood 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 CowConsistent 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 borrowedIf
TokenText
exposesas_str()
(orDeref<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 viato_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 confusionInside 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 crateThis 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 appropriateCurrently 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.
Summary
Upgraded to the Rust toolchain v1.89.0 and fixed lint warnings.
Test Plan
Existing tests should pass.
Docs
N/A