Add #[derive(Clone, Copy... on all bitflags#1396
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1396 +/- ##
=======================================
Coverage 81.08% 81.08%
=======================================
Files 51 51
Lines 10345 10345
=======================================
Hits 8388 8388
Misses 1957 1957 ☔ View full report in Codecov by Sentry. |
|
|
|
They are clearly not as useful as Speaking of derive - there are many enums that also do not implement |
YAGNI: https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it |
|
@gwenn YAGNII is my fav principle too, but the cost of submitting a PR and discussing it, and waiting for release is also pretty high, so what's the middle ground? I will add the clone/copy where makes sense - that's what I do need. Is that ok? |
Yes, please. |
097ce05 to
79d8edd
Compare
|
i tried to clean them up a bit, adding just the copy/clone where it seem to make sense. Overall, looking at many |
This will make it easier to use them, e.g. I won't need to re-create `FunctionFlags` for registering multiple similar functions.
79d8edd to
7c58506
Compare
|
@gwenn should i make any changes to this PR? |
src/vtab/mod.rs
Outdated
| /// Index constraint operator. | ||
| /// See [Virtual Table Constraint Operator Codes](https://sqlite.org/c3ref/c_index_constraint_eq.html) for details. | ||
| #[derive(Debug, Eq, PartialEq)] | ||
| #[derive(Copy, Clone, Debug, Eq, PartialEq)] |
There was a problem hiding this comment.
Created only by SQLite itself (readonly on rusqlite side)
src/vtab/mod.rs
Outdated
| // ffi::sqlite3_vtab_cursor => VTabCursor | ||
|
|
||
| /// Virtual table kind | ||
| #[derive(Copy, Clone, Debug)] |
There was a problem hiding this comment.
Used only as a constant at compile time.
src/vtab/series.rs
Outdated
|
|
||
| bitflags::bitflags! { | ||
| #[derive(Clone, Copy)] | ||
| #[derive(Clone, Copy, Debug)] |
There was a problem hiding this comment.
Use only to pass information between best_index and filter methods.
src/session.rs
Outdated
| #[allow(missing_docs)] | ||
| #[repr(i32)] | ||
| #[derive(Debug, PartialEq, Eq)] | ||
| #[derive(Copy, Clone, Debug, PartialEq, Eq)] |
There was a problem hiding this comment.
Created only by SQLite (readonly on rusqlite side)
nyurik
left a comment
There was a problem hiding this comment.
thx, reverted the ones you suggested, and also merged main for ease of review. You may want to squash when merging though
src/vtab/mod.rs
Outdated
| /// Index constraint operator. | ||
| /// See [Virtual Table Constraint Operator Codes](https://sqlite.org/c3ref/c_index_constraint_eq.html) for details. | ||
| #[derive(Debug, Eq, PartialEq)] | ||
| #[derive(Copy, Clone, Debug, Eq, PartialEq)] |
src/vtab/mod.rs
Outdated
| // ffi::sqlite3_vtab_cursor => VTabCursor | ||
|
|
||
| /// Virtual table kind | ||
| #[derive(Copy, Clone, Debug)] |
src/session.rs
Outdated
| #[allow(missing_docs)] | ||
| #[repr(i32)] | ||
| #[derive(Debug, PartialEq, Eq)] | ||
| #[derive(Copy, Clone, Debug, PartialEq, Eq)] |
src/vtab/series.rs
Outdated
|
|
||
| bitflags::bitflags! { | ||
| #[derive(Clone, Copy)] | ||
| #[derive(Clone, Copy, Debug)] |
This will make it easier to use them, e.g. I won't need to re-create
FunctionFlagsfor registering multiple similar functions.