Conversation
Prevents future breaking changes when adding new theme fields, since users must use `..Default::default()` instead of struct literals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the forward compatibility of the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the #[non_exhaustive] attribute to the Theme struct. This change prevents consumers of the library from exhaustively constructing the struct, thereby allowing new fields to be added in the future without causing breaking changes. The implementation is correct and achieves the stated goal. No issues were found in this change.
Greptile SummaryThis PR marks the public Key concern: The PR title and description only mention Confidence Score: 2/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Downstream crate] --> B{Constructing Theme?}
B -- "struct literal / update syntax\nTheme { .., ..Theme::default() }" --> C["❌ Compile error\n(non_exhaustive blocks all struct-literal forms)"]
B -- "field mutation\nlet mut t = Theme::default()\nt.field = value" --> D["✅ Compiles fine"]
A --> E{Matching CursorShape?}
E -- "exhaustive match\nBlock => .. / Underline => .." --> F["❌ Compile error\n(non_exhaustive requires wildcard arm)"]
E -- "match with wildcard\nBlock => .. / Underline => .. / _ => .." --> G["✅ Compiles fine"]
Last reviewed commit: 4d1422d |
Struct literal syntax doesn't work for #[non_exhaustive] structs from external crates. Use field assignment on a default instance instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents breaking changes when adding new cursor shape variants (e.g., Beam) since external code must include a wildcard match arm. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
|
||
| pub(crate) static DEFAULT: LazyLock<Theme> = LazyLock::new(Theme::default); | ||
|
|
||
| #[non_exhaustive] |
There was a problem hiding this comment.
Unmentioned non_exhaustive on CursorShape is breaking change
Medium Severity
#[non_exhaustive] was added to CursorShape enum but is not mentioned in the PR title or description (which only references the Theme struct). This is itself a breaking change — external crate users who exhaustively match on CursorShape::Block and CursorShape::Underline without a wildcard arm will get a compilation error. If intentional, it warrants documentation; if unintentional, it may be a mistake.
| #[non_exhaustive] | ||
| #[derive(Clone, Debug)] | ||
| pub enum CursorShape { |
There was a problem hiding this comment.
The PR title and description only mention adding #[non_exhaustive] to Theme, but #[non_exhaustive] was also added to the CursorShape enum (lines 7–8). The implications for an enum are distinct: any downstream code that exhaustively pattern-matches on CursorShape without a catch-all arm will now fail to compile, e.g.:
match theme.cursor_shape {
CursorShape::Block => { /* ... */ }
CursorShape::Underline => { /* ... */ }
// ↑ compile error: non-exhaustive patterns, add `_` arm
}This is a separate semver-breaking change from the Theme struct change. It should be explicitly called out in the PR description and changelog so downstream users know they need to add a wildcard arm to any exhaustive match on CursorShape.


Summary
#[non_exhaustive]to theThemestruct so new fields can be added without breaking changes..Theme::default()or..Default::default()are unaffectedTest plan
cargo checkpassestheme.rsalready uses..Theme::default()spread syntax🤖 Generated with Claude Code
Note
Low Risk
Small API annotation/doc change; main impact is that downstream code can no longer construct
Theme/matchCursorShapeexhaustively outside the crate.Overview
Marks the public
Themestruct (andCursorShapeenum) as#[non_exhaustive]to allow adding new fields/variants without breaking downstream crates.Updates the doc example to build a theme via
Theme::default()and then mutate fields, instead of using a struct literal with..Theme::default().Written by Cursor Bugbot for commit 4d1422d. This will update automatically on new commits. Configure here.