Skip to content

clients: replace lifetime-annotated Request with owned String field#100

Open
ooloth wants to merge 2 commits into
mainfrom
claude/issue-67
Open

clients: replace lifetime-annotated Request with owned String field#100
ooloth wants to merge 2 commits into
mainfrom
claude/issue-67

Conversation

@ooloth
Copy link
Copy Markdown
Owner

@ooloth ooloth commented May 19, 2026

✅ What

  • Replaces &'a str with String in the Request struct in clients/src/linear.rs, removing its lifetime parameter entirely
  • Calls .to_string() at the single construction site

🤔 Why

  • The lifetime annotation on Request forced callers to ensure the query string outlived the struct, adding hidden constraints that resist refactoring
  • The struct is constructed and immediately serialized — it has no reason to borrow; owning is the right choice

👩‍🔬 How to validate

  • Open clients/src/linear.rs and expect struct Request { query: String } with no 'a lifetime parameter
  • Search the file for Request { and expect the construction site to use .to_string()
  • Run cargo check from the workspace root and expect zero errors

🔖 Related links

Closes #67


Generated by Claude Code

#67

`struct Request<'a> { query: &'a str }` forced all callers to satisfy
a lifetime constraint, tying the struct's validity to the borrow
duration of an external string. The struct is constructed and
immediately serialized; it does not need to borrow — it should own.

Replace the `&'a str` field with `String`, drop the lifetime parameter,
and call `.to_string()` at the single construction site. The struct can
now be stored, moved, and passed freely without lifetime annotations.

Closes #67
Copilot AI review requested due to automatic review settings May 19, 2026 05:10
@ooloth ooloth added the author:agent This was authored by an agent. label May 19, 2026 — with Claude
@ooloth ooloth self-assigned this May 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the lifetime parameter from the Request struct in clients/src/linear.rs by changing its query field from &'a str to an owned String, simplifying lifetime management at the cost of one allocation per call.

Changes:

  • Replace struct Request<'a> { query: &'a str } with struct Request { query: String }
  • Update the single construction site to call .to_string() on the query

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Owner Author

ooloth commented May 19, 2026

CI failure is pre-existing and unrelated to this PR.

The two failing tests (fetch::tests::ensure_pr_worktree_reentry_fetches_remote_tracking_refs and fetch::tests::sync_default_branch_worktree_fetches_then_resets_to_latest_commit) fail identically on main — they appear to require a real git remote/network that isn't available in the CI environment. The changes in this PR touch only clients/src/linear.rs and have no effect on workflows/src/fetch.rs.

cargo fmt --check and cargo clippy -- -D warnings both pass clean on this branch.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:agent This was authored by an agent.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace lifetime-annotated Request struct in linear.rs with owned String field

2 participants