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
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
@@ -322,7 +323,7 @@ pub trait UpdateVTab<'vtab>: CreateVTab<'vtab> { | |||
|
|||
/// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created only by SQLite itself (readonly on rusqlite side)
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.
reverted
src/vtab/mod.rs
Outdated
@@ -59,6 +59,7 @@ use crate::{str_to_cstring, Connection, Error, InnerConnection, Result}; | |||
// ffi::sqlite3_vtab_cursor => VTabCursor | |||
|
|||
/// Virtual table kind | |||
#[derive(Copy, Clone, Debug)] |
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.
Used only as a constant at compile time.
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.
reverted
src/vtab/series.rs
Outdated
@@ -28,7 +28,7 @@ const SERIES_COLUMN_STOP: c_int = 2; | |||
const SERIES_COLUMN_STEP: c_int = 3; | |||
|
|||
bitflags::bitflags! { | |||
#[derive(Clone, Copy)] | |||
#[derive(Clone, Copy, Debug)] |
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.
Use only to pass information between best_index
and filter
methods.
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.
reverted
src/session.rs
Outdated
@@ -655,7 +655,7 @@ impl Connection { | |||
/// See [here](https://sqlite.org/session.html#SQLITE_CHANGESET_CONFLICT) for details. | |||
#[allow(missing_docs)] | |||
#[repr(i32)] | |||
#[derive(Debug, PartialEq, Eq)] | |||
#[derive(Copy, Clone, Debug, PartialEq, Eq)] |
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.
Created only by SQLite (readonly on rusqlite side)
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.
reverted
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.
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
@@ -322,7 +323,7 @@ pub trait UpdateVTab<'vtab>: CreateVTab<'vtab> { | |||
|
|||
/// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
src/vtab/mod.rs
Outdated
@@ -59,6 +59,7 @@ use crate::{str_to_cstring, Connection, Error, InnerConnection, Result}; | |||
// ffi::sqlite3_vtab_cursor => VTabCursor | |||
|
|||
/// Virtual table kind | |||
#[derive(Copy, Clone, Debug)] |
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.
reverted
src/session.rs
Outdated
@@ -655,7 +655,7 @@ impl Connection { | |||
/// See [here](https://sqlite.org/session.html#SQLITE_CHANGESET_CONFLICT) for details. | |||
#[allow(missing_docs)] | |||
#[repr(i32)] | |||
#[derive(Debug, PartialEq, Eq)] | |||
#[derive(Copy, Clone, Debug, PartialEq, Eq)] |
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.
reverted
src/vtab/series.rs
Outdated
@@ -28,7 +28,7 @@ const SERIES_COLUMN_STOP: c_int = 2; | |||
const SERIES_COLUMN_STEP: c_int = 3; | |||
|
|||
bitflags::bitflags! { | |||
#[derive(Clone, Copy)] | |||
#[derive(Clone, Copy, Debug)] |
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.
reverted
This will make it easier to use them, e.g. I won't need to re-create
FunctionFlags
for registering multiple similar functions.