tursodatabase / tursodatabase/libsql
rusqlite methods on Statement are `mut`, libsql should be compatible without warning
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 17.2k
- Forks
- 531
- Avg merge
- 1h 12m
- Merged PRs (30d)
- 1
Description
Methods on rusqlite Statement generally look like this:
pub fn foo(&mut self, ...)
Note the &mut self. This means that the developer must declare Statement objects with mut in order to call methods on them. (It seems that rusqlite's implementation of Statement really is mutable.) libSQL doesn't have the same implementation, however, this means that rusqlite code that gets ported to libSQL is now littered with warnings, which is not a great experience:
let mut stmt = conn.prepare("...")?;
warning: variable does not need to be mutable
--> path/to/file.rs:36:9
|
36 | let mut stmt = conn.prepare("...")?;
| ----^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
We should consider also declaring methods the same way in order to avoid this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the libSQL Statement API and the conn.prepare entry point, then compare its method receiver signatures with rusqlite's Statement methods. Determine the affected methods and update them for compatible mutability without warnings, confirming that ported rusqlite-style code no longer produces unused_mut warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sqlite
- Domain
- database
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100