commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
b383ea0b349b8a23e1a5a57ff606aa4f1b67d07e
daxpedda
2025-05-17T13:45:31
Document why we re-direct to a derive macro (#117)
diff --git a/src/lib.rs b/src/lib.rs index a62b308..13a4109 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -568,6 +568,9 @@ fn derive_where_internal(mut item: DeriveInput) -> Result<TokenStream> { Ok(output) } +/// Internally we re-direct the attribute macro to the derive macro. Unlike the +/// attribute macro, the d...
1
3
0
be42620a893661497321d6efc57002dfb2b92573
daxpedda
2025-04-29T08:53:07
Fix tests
diff --git a/src/test/bound.rs b/src/test/bound.rs index c440fda..a26658c 100644 --- a/src/test/bound.rs +++ b/src/test/bound.rs @@ -128,7 +128,10 @@ fn for_lifetime() -> Result<()> { #[inline] fn clone(&self) -> Self { match self { - Test(ref __field_0, ref __field_1) => Test(::core::clone::Clone:...
1
4
1
2bf44d0f56baa1890cdcdb734ca104e8fb304baa
daxpedda
2025-04-15T07:02:33
Fix CI (#108)
diff --git a/src/attr/skip.rs b/src/attr/skip.rs index e146d58..cd8fc9e 100644 --- a/src/attr/skip.rs +++ b/src/attr/skip.rs @@ -157,7 +157,7 @@ impl Skip { match self { Skip::None => false, Skip::All => true, - Skip::Traits(groups) => groups.iter().any(|this_group| *this_group == group), + Skip::Traits(...
1
1
1
53243cc4ddc396f1dd55a949a87744fc7701b679
Aleksei Bavshin
2024-12-01T20:46:26
Fix source file permissions. `lib.rs` seems to be erroneously marked as executable. This has no purpose, and combined with the `#![...]` in the first line confuses any tools that expect the shebang line.
diff --git a/src/lib.rs b/src/lib.rs old mode 100755 new mode 100644
1
0
0
cafac836ff339261f16902217cdd40007ff01b10
daxpedda
2024-08-04T20:54:17
Remove `allow(unused)` in favor of `cfg` guards
diff --git a/src/data.rs b/src/data.rs index afe3008..e2f3553 100644 --- a/src/data.rs +++ b/src/data.rs @@ -4,7 +4,9 @@ mod field; mod fields; use proc_macro2::Span; -use syn::{Expr, FieldsNamed, Ident, Pat, PatPath, Path, Result, Variant}; +#[cfg(not(feature = "nightly"))] +use syn::Expr; +use syn::{FieldsNamed, ...
15
49
22
a6264a2bf7fb797312e0df003784f63cfb166a4e
Roland Fredenhagen
2024-08-03T22:12:11
Add `wheres` to dictionary
diff --git a/Cargo.toml b/Cargo.toml index c37b968..85f5497 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,3 +47,6 @@ zeroize_ = { version = "1.5", package = "zeroize", default-features = false } [package.metadata.docs.rs] all-features = true targets = [] + +[workspace.metadata.typos] +default.extend-words.wheres =...
1
3
0
d29e936c80d2b294cba4505e91cf3727e08273bf
Roland Fredenhagen
2024-08-03T21:25:40
Fix typos
diff --git a/src/lib.rs b/src/lib.rs index dbe36d7..89feddb 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -55,7 +55,7 @@ //! //! ## Generic type bounds //! -//! Separated from the list of traits with a semi-colon, types to bind to can be +//! Separated from the list of traits with a semicolon, types to bind to can be ...
1
2
2
f95ebce561c61b283fb388c92235141e4056a13d
Roland Fredenhagen
2024-08-03T21:23:47
Fix clippy
diff --git a/src/data.rs b/src/data.rs index 4b09c1c..afe3008 100644 --- a/src/data.rs +++ b/src/data.rs @@ -27,6 +27,7 @@ pub struct Data<'a> { pub path: Path, /// [Type](DataType) of this struct, union or variant. pub type_: DataType<'a>, + #[cfg_attr(feature = "nightly", allow(unused))] /// Discriminant of t...
14
27
18
19bac2b09b9e79f0df07b0e054f61819e87604df
daxpedda
2023-12-04T15:35:18
Remove unused import
diff --git a/src/attr.rs b/src/attr.rs index 1f8d5c7..9b8419d 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -15,7 +15,7 @@ pub use self::{ default::Default, field::FieldAttr, incomparable::Incomparable, - item::{DeriveTrait, DeriveWhere, Generic, ItemAttr}, + item::{DeriveTrait, DeriveWhere, ItemAttr}, skip::{S...
1
1
1
02f6d8eb934b8c427fdffd8ba86358188cf716d0
daxpedda
2023-09-03T09:39:50
Make `discriminant` function `const` (#82)
diff --git a/src/test/basic.rs b/src/test/basic.rs index bd5e9c6..df1b10b 100644 --- a/src/test/basic.rs +++ b/src/test/basic.rs @@ -197,7 +197,7 @@ fn enum_() -> Result<()> { }; #[cfg(not(feature = "nightly"))] let ord = quote! { - fn __discriminant<T>(__this: &Test<T>) -> isize { + const fn __discriminant<T>(...
7
36
36
0e99f7c5e984315c82e520562cfa35a2464178cc
daxpedda
2023-08-31T22:25:03
Account for unknown representations
diff --git a/src/error.rs b/src/error.rs index c6d2351..79ebe7e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -213,10 +213,15 @@ impl Error { } /// `repr` attribute that isn't a meta list. - pub fn repr(span: Span) -> syn::Error { + pub fn repr_parse(span: Span) -> syn::Error { syn::Error::new(span, "unable ...
2
9
2
485927db92f3918171c3f311320b2775375895f9
daxpedda
2023-08-31T22:18:18
Account for unknown size with `repr(C)`
diff --git a/src/item.rs b/src/item.rs index 2c48f2a..10cb462 100644 --- a/src/item.rs +++ b/src/item.rs @@ -98,12 +98,13 @@ impl Item<'_> { /// Type of discriminant used. #[cfg_attr(test, derive(Debug))] pub enum Discriminant { + /// The enum uses the default representation but has a non-unit variant or + /// an en...
3
10
66
52b4f44bc44716296ac299beb21565fc7ccef6aa
daxpedda
2023-08-31T19:36:13
Address review
diff --git a/src/item.rs b/src/item.rs index 0efaea2..2c48f2a 100644 --- a/src/item.rs +++ b/src/item.rs @@ -3,8 +3,7 @@ use proc_macro2::TokenStream; use quote::{quote, ToTokens}; use syn::{ - punctuated::Punctuated, spanned::Spanned, Attribute, Fields, Ident, Meta, Result, Token, - Variant, + punctuated::Punctuate...
2
27
68
7eaf87018416518ad50f9aff300e20d5dcaae684
daxpedda
2023-08-31T11:54:31
Fix typos (#74)
diff --git a/src/test/basic.rs b/src/test/basic.rs index 22d1244..cf7b140 100644 --- a/src/test/basic.rs +++ b/src/test/basic.rs @@ -8,7 +8,7 @@ fn struct_() -> Result<()> { test_derive( quote! { #[derive_where(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] - struct Test<T> { field: std:...
5
28
28
2dd3f701f4a0e864fa05eb46487e3ac9d6b2ab4d
daxpedda
2023-08-22T07:57:29
Address Rustdoc lints
diff --git a/src/attr/default.rs b/src/attr/default.rs index 95494c9..09bc32f 100644 --- a/src/attr/default.rs +++ b/src/attr/default.rs @@ -6,7 +6,7 @@ use syn::{spanned::Spanned, Meta, Result}; use crate::{DeriveWhere, Error, Trait}; /// Stores if this variant should be the default when implementing -/// [`Defaul...
12
24
21
ec25e61dc9e35a004b251ab1d7a99a15f2fbd816
daxpedda
2023-08-22T07:46:53
Allow internal features
diff --git a/src/lib.rs b/src/lib.rs index 1b56464..2998a83 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,9 @@ #![deny(unsafe_code)] -#![cfg_attr(feature = "nightly", feature(allow_internal_unstable))] +#![cfg_attr( + feature = "nightly", + feature(allow_internal_unstable), + allow(internal_features) +)] #![all...
1
5
1
41c4cefceb253704a0d9872e103df3eaa417fc1b
dAxpeDDa
2023-04-13T18:56:50
Address review Co-Authored-By: Roland Fredenhagen <dev@modprog.de>
diff --git a/src/data/field.rs b/src/data/field.rs index e8667cc..c2ef2cc 100644 --- a/src/data/field.rs +++ b/src/data/field.rs @@ -3,7 +3,7 @@ use std::fmt::{self, Display, Formatter}; use proc_macro2::{Span, TokenStream}; -use quote::{format_ident, IdentFragment, ToTokens, TokenStreamExt}; +use quote::{format_id...
1
3
3
b34671cf4472a49c5f46e9eeef0bf310ce377316
dAxpeDDa
2023-04-13T13:54:15
Handle raw identifiers in named fields
diff --git a/src/data/field.rs b/src/data/field.rs index 4c1a63e..e8667cc 100644 --- a/src/data/field.rs +++ b/src/data/field.rs @@ -4,7 +4,7 @@ use std::fmt::{self, Display, Formatter}; use proc_macro2::{Span, TokenStream}; use quote::{format_ident, IdentFragment, ToTokens, TokenStreamExt}; -use syn::{Attribute, F...
2
30
2
93fbd6f290ec6b1e465ff0c5a3858616641b5dd1
dAxpeDDa
2023-03-19T15:25:22
Add struct enum variant tests
diff --git a/tests/skip/debug.rs b/tests/skip/debug.rs index fc6ab0b..9e9df97 100644 --- a/tests/skip/debug.rs +++ b/tests/skip/debug.rs @@ -3,7 +3,7 @@ use derive_where::derive_where; use crate::util::{AssertDebug, Wrapper}; #[test] -fn all() { +fn struct_all() { #[derive_where(Debug)] #[derive_where(skip_inne...
1
38
2
d2c1b38b903a9677b0f453d5631f60ac028aa96a
dAxpeDDa
2023-01-03T08:22:23
Fix typos
diff --git a/src/trait_/common_ord.rs b/src/trait_/common_ord.rs index 8329043..5aab128 100644 --- a/src/trait_/common_ord.rs +++ b/src/trait_/common_ord.rs @@ -162,7 +162,7 @@ pub fn build_ord_signature(item: &Item, trait_: &DeriveTrait, body: &TokenStream } } } - // If there is only one variant and it's ...
2
2
2
3d1ec231f1b133e23610147f055f5906927adaa3
dAxpeDDa
2022-03-07T10:01:57
Configure `docs.rs`
diff --git a/Cargo.toml b/Cargo.toml index 041b8dc..6c6f09e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,3 +46,7 @@ zeroize_ = { version = "1.5", package = "zeroize", default-features = false } name = "util" path = "tests/util.rs" test = false + +[package.metadata.docs.rs] +all-features = true +targets = []
1
4
0
c689893280235a751b6c9de6e45bc62adb4c5b09
daxpedda
2022-02-22T16:56:53
Enforce `Eq` trait on field types
diff --git a/src/data/field.rs b/src/data/field.rs index 516effc..3eb62eb 100644 --- a/src/data/field.rs +++ b/src/data/field.rs @@ -4,7 +4,7 @@ use std::fmt::{self, Display, Formatter}; use proc_macro2::{Span, TokenStream}; use quote::{format_ident, IdentFragment, ToTokens, TokenStreamExt}; -use syn::{Attribute, F...
4
94
11
a35cf051b7f638069f816ae3d2c552e63ae8e762
daxpedda
2022-02-20T15:08:18
Improve formatting in `quote!`
diff --git a/src/test/basic.rs b/src/test/basic.rs index 8a38b3b..c2d6a9c 100644 --- a/src/test/basic.rs +++ b/src/test/basic.rs @@ -11,8 +11,7 @@ fn struct_() -> Result<()> { struct Test<T> { field: std::marker::PhatomData<T> } }, quote! { - impl<T> ::core::clone::Clone for Test<T> - { + impl<T> ::core...
4
40
80
646870bb8bfadb9493294242f9c184723b4882ff
daxpedda
2022-02-20T15:03:07
Improve `Clone` code-gen when `Copy` is present
diff --git a/src/attr/item.rs b/src/attr/item.rs index 54458b1..be06d23 100644 --- a/src/attr/item.rs +++ b/src/attr/item.rs @@ -95,6 +95,7 @@ impl ItemAttr { .derive_wheres .dedup_by(|derive_where_1, derive_where_2| { if derive_where_1.generics == derive_where_2.generics { + derive_where_2.spans.appen...
16
242
114
215c0c5a3235a797a59f5a00e9a7515433625a04
daxpedda
2022-02-20T12:54:10
Document why we had to change the MSRV
diff --git a/src/lib.rs b/src/lib.rs index c219571..ef87e5c 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -541,6 +541,11 @@ pub fn derive_where_actual(input: proc_macro::TokenStream) -> proc_macro::TokenS /// Marker attribute signifying that this item was already processed by a /// `derive_where` attribute before. This...
1
5
0
740f3d3b06d7548d584b8d5cc4e93b8f11e63653
daxpedda
2022-01-21T12:46:23
Add test for `#[derive_where(crate = "..")]`
diff --git a/Cargo.toml b/Cargo.toml index 300be9b..122e5b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] default-members = [""] -members = ["", "ensure-no-std", "non-msrv-tests"] +members = ["", "crate_", "ensure-no-std", "non-msrv-tests"] resolver = "2" [package] diff --git a/crate_/Cargo...
3
33
1
64ef4afca99310409ca2cfdfb87d8ba6c03b402e
daxpedda
2022-01-21T16:48:02
Improve code generation of `Ord` and `PartialOrd` for variants between the first and last
diff --git a/src/data.rs b/src/data.rs index 0506020..be24619 100644 --- a/src/data.rs +++ b/src/data.rs @@ -231,9 +231,9 @@ impl<'a> Data<'a> { /// Returns the destructuring `other` pattern of this [`Data`]. #[cfg(all(not(feature = "nightly"), feature = "safe"))] - pub fn other_pattern(&self) -> &Pat { + pub fn ...
4
69
56
9e0a88beb721090c71404a98debc41ccb102faf6
daxpedda
2022-01-21T13:07:55
Improve code generation of `Ord` and `PartialOrd` for the first and last variant
diff --git a/src/test/basic.rs b/src/test/basic.rs index f567c29..781653e 100644 --- a/src/test/basic.rs +++ b/src/test/basic.rs @@ -220,14 +220,7 @@ fn enum_() -> Result<()> { #[cfg(all(not(feature = "nightly"), feature = "safe"))] let ord = quote! { match self { - Test::A { field: ref __field } => - match...
4
52
115
74dbe2c97a5b30e59936e958e0924f3d1cecd090
dAxpeDDa
2022-01-09T15:15:47
Simplify drop testing code
diff --git a/non-msrv-tests/tests/util.rs b/non-msrv-tests/tests/util.rs index c3bade0..30b5d0e 100644 --- a/non-msrv-tests/tests/util.rs +++ b/non-msrv-tests/tests/util.rs @@ -49,16 +49,7 @@ pub struct AssertZeroize<'a, T: Zeroize>(pub &'a T); #[cfg(feature = "zeroize-on-drop")] pub struct AssertZeroizeOnDrop<'a, T:...
1
3
12
6051b49f513b2545a97c272452029c2816193f8d
ModProg
2021-12-08T18:11:08
fix publish
diff --git a/Cargo.toml b/Cargo.toml index 6660f26..256cb25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,4 +41,5 @@ syn = { version = "1", default-features = false, features = ["extra-traits"] } [[test]] name = "util" +path = "tests/util.rs" test = false
1
1
0
46a195be4794be4deb57ee340cbf5c5ce81b2aaf
daxpedda
2021-12-07T23:04:30
Fix Rustdoc
diff --git a/src/attr/field.rs b/src/attr/field.rs index 3777995..2581ccf 100644 --- a/src/attr/field.rs +++ b/src/attr/field.rs @@ -10,7 +10,7 @@ use crate::{Trait, TraitImpl, ZeroizeFqs}; #[derive(Default)] #[cfg_attr(test, derive(Debug))] pub struct FieldAttr { - /// [`Trait`]s to skip this field for. + /// [`Tra...
1
1
1
a53c79a4a3eb430a358bd6ee02c1cfc1f256ab3a
daxpedda
2021-12-07T22:58:14
Fix Clippy
diff --git a/src/attr/field.rs b/src/attr/field.rs index 7aa86d7..3777995 100644 --- a/src/attr/field.rs +++ b/src/attr/field.rs @@ -2,9 +2,9 @@ use syn::{spanned::Spanned, Attribute, Meta, NestedMeta, Result}; -use crate::{DeriveWhere, Error, Skip, Trait, DERIVE_WHERE}; +use crate::{DeriveWhere, Error, Skip, DERI...
1
2
2
12562b2dd99f76e46ec896d810669147403b4fc8
daxpedda
2021-12-07T22:55:46
Improve link to `Zeroize`
diff --git a/src/attr/field.rs b/src/attr/field.rs index e37d73d..7aa86d7 100644 --- a/src/attr/field.rs +++ b/src/attr/field.rs @@ -12,7 +12,7 @@ use crate::{TraitImpl, ZeroizeFqs}; pub struct FieldAttr { /// [`Trait`]s to skip this field for. pub skip: Skip, - /// Use fully-qualified-syntax for the [`Zeroize`](h...
6
9
9
3b23fc8cabc08854a887e4cf49b96a145c40d35b
daxpedda
2021-12-07T22:46:03
Overhaul use-case checking
diff --git a/src/attr/item.rs b/src/attr/item.rs index 3a86d3e..716a91c 100644 --- a/src/attr/item.rs +++ b/src/attr/item.rs @@ -104,7 +104,7 @@ pub struct DeriveWhere { /// Save [`Span`] for error messages. pub span: Span, /// [traits](DeriveTrait) to implement. - pub traits: Vec<DeriveTrait>, + pub traits: Vec<...
8
83
138
7880bb8c7d50a0fca646ad13b215ea107ed5d260
daxpedda
2021-12-07T21:00:21
Accept empty enums if they implement `Default`
diff --git a/src/input.rs b/src/input.rs index 9854dde..872d2b0 100644 --- a/src/input.rs +++ b/src/input.rs @@ -48,14 +48,6 @@ impl<'a> Input<'a> { .map(|variant| Data::from_variant(ident, &derive_wheres, variant)) .collect::<Result<Vec<Data>>>()?; - // Empty enums aren't allowed. - if variants.ite...
1
9
8
0c78d9df4e283390673d60d2fbbfeaefeda1d7b3
daxpedda
2021-12-07T20:33:32
Code improvements around enum parsing
diff --git a/src/attr/default.rs b/src/attr/default.rs index 26787cb..456f94b 100644 --- a/src/attr/default.rs +++ b/src/attr/default.rs @@ -1,5 +1,6 @@ //! Attribute parsing for the `default` option. +use proc_macro2::Span; use syn::{spanned::Spanned, Meta, Result}; use crate::{DeriveWhere, Error, Trait}; @@ -8...
4
52
66
c9dc95ccbadf056654fc958461f1acf0d73dc2cb
daxpedda
2021-12-07T19:36:28
Small code improvements on `Skip`
diff --git a/src/attr/field.rs b/src/attr/field.rs index b24839b..e37d73d 100644 --- a/src/attr/field.rs +++ b/src/attr/field.rs @@ -80,9 +80,4 @@ impl FieldAttr { Err(Error::option_syntax(meta.span())) } } - - /// Returns `true` if this field is skipped with the given [`Trait`]. - pub fn skip(&self, trait_: &...
3
3
8
a2628df051ec9c91d9d84c9245bc76e2ae4c8918
daxpedda
2021-12-07T18:41:41
De-duplicate searching for skippable traits
diff --git a/src/attr/default.rs b/src/attr/default.rs index 5fd6887..26787cb 100644 --- a/src/attr/default.rs +++ b/src/attr/default.rs @@ -30,7 +30,7 @@ impl Default { let mut impl_default = false; for derive_where in derive_wheres { - if derive_where.trait_(Trait::Default).is_some() { + if derive...
6
24
23
35f14cff2df9b1afe617bf039e6a14d0cdb10da4
daxpedda
2021-12-07T18:20:22
Add skip unit tests
diff --git a/src/test/mod.rs b/src/test/mod.rs index 6777fc7..e329e35 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -2,6 +2,7 @@ mod basic; mod bound; mod enum_; mod misc; +mod skip; #[cfg(feature = "zeroize")] mod zeroize; diff --git a/src/test/skip.rs b/src/test/skip.rs new file mode 100644 index 00000...
2
238
0
b0cc0350481db0c0101820a316ffd5e25797ea50
daxpedda
2021-12-07T17:45:24
Improve testing utilities and add `Zeroize` hygiene tests
diff --git a/non-msrv-tests/tests/util.rs b/non-msrv-tests/tests/util.rs index 8c7ee6e..b7f4854 100644 --- a/non-msrv-tests/tests/util.rs +++ b/non-msrv-tests/tests/util.rs @@ -5,6 +5,9 @@ use std::{ ptr, }; +#[cfg(feature = "zeroize")] +use zeroize_::Zeroize; + pub struct Wrapper<T = ()> { data: i32, hack: P...
13
325
134
58a4fb5343c467e959ca78148ce88f90bfb70435
daxpedda
2021-12-07T17:18:39
Add bound integration tests
diff --git a/tests/bound.rs b/tests/bound.rs new file mode 100644 index 0000000..c6fb484 --- /dev/null +++ b/tests/bound.rs @@ -0,0 +1,53 @@ +mod util; + +use std::marker::PhantomData; + +use derive_where::DeriveWhere; + +use self::util::AssertClone; + +#[test] +fn custom_generic() { + trait Trait { + type Type; + } +...
3
54
145
d0323f451c3f84d5c64562ea730f4255c4a3d6ca
daxpedda
2021-12-07T17:18:21
Fix MSRV tests
diff --git a/tests/skip.rs b/tests/skip.rs index 986b2f7..39eeadf 100644 --- a/tests/skip.rs +++ b/tests/skip.rs @@ -1,5 +1,9 @@ #![allow(clippy::clone_on_copy)] +// Necessary for rustfmt. +#[path = "util.rs"] +#[macro_use] +mod util; #[path = "skip/field.rs"] mod field; #[path = "skip/field_trait.rs"] @@ -12,7 +...
1
4
4
1eb9e7da1220321611939f4586e6dc38165a9cab
daxpedda
2021-12-07T16:46:10
Rework tests and add `skip` tests
diff --git a/tests/enum_mixed.rs b/tests/enum_mixed.rs index 79d1719..384e52b 100644 --- a/tests/enum_mixed.rs +++ b/tests/enum_mixed.rs @@ -3,10 +3,7 @@ #[macro_use] mod util; -use std::{ - collections::hash_map::DefaultHasher, - hash::{Hash, Hasher}, -}; +use std::cmp::Ordering; use derive_where::DeriveWhere; ...
13
1,078
281
076cba32afec8b424cd5c0825bad83aa17c6679e
daxpedda
2021-12-07T16:45:43
Fix empty enum variants for `PartialEq`, `PartialOrd` and `Ord`
diff --git a/src/item.rs b/src/item.rs index cd1fbbb..8482985 100644 --- a/src/item.rs +++ b/src/item.rs @@ -71,4 +71,13 @@ impl Item<'_> { }), } } + + /// Returns `true` if all [`Fields`](crate::Fields) are empty for this + /// [`Trait`]. + pub fn is_empty(&self, trait_: &Trait) -> bool { + match self { + ...
3
57
22
36412ae8db92da5a06e0a6b998bfa151126826c2
daxpedda
2021-12-07T10:41:21
Fix `Zeroize` non-FQS
diff --git a/src/test/zeroize.rs b/src/test/zeroize.rs index a62b390..106dbec 100644 --- a/src/test/zeroize.rs +++ b/src/test/zeroize.rs @@ -14,6 +14,8 @@ fn basic() -> Result<()> { impl<T> ::zeroize::Zeroize for Test<T> { fn zeroize(&mut self) { + use ::zeroize::Zeroize; + match self { Te...
2
22
5
b568af33d2d1ab1b95015bcaf66ccb7f3848ade7
daxpedda
2021-12-07T10:36:08
Tiny improvement in ensure-no-std
diff --git a/ensure-no-std/src/lib.rs b/ensure-no-std/src/lib.rs index 347e407..6060478 100644 --- a/ensure-no-std/src/lib.rs +++ b/ensure-no-std/src/lib.rs @@ -5,7 +5,9 @@ extern crate zeroize_ as zeroize; use core::marker::PhantomData; -#[derive(derive_where::DeriveWhere)] +use derive_where::DeriveWhere; + +#[de...
1
3
1
6c19a1dabea5083ac54d0514e467d3e9188bf051
daxpedda
2021-12-07T09:38:49
Add `Zeroize` tests and improve overall test naming
diff --git a/non-msrv-tests/tests/util.rs b/non-msrv-tests/tests/util.rs index e0ae7d9..8c7ee6e 100644 --- a/non-msrv-tests/tests/util.rs +++ b/non-msrv-tests/tests/util.rs @@ -2,6 +2,7 @@ use std::{ fmt, fmt::{Debug, Formatter}, marker::PhantomData, + ptr, }; pub struct Wrapper<T = ()> { @@ -36,3 +37,17 @@ i...
4
128
39
1deeeb95563fd1f8231bbbf539eb777d0bd25f39
daxpedda
2021-12-06T16:44:33
Skip improvements and fixes
diff --git a/src/attr/skip.rs b/src/attr/skip.rs index 8f9a5ae..e7dc9f3 100644 --- a/src/attr/skip.rs +++ b/src/attr/skip.rs @@ -30,7 +30,7 @@ impl Skip { pub const SKIP_INNER: &'static str = "skip_inner"; /// Returns `true` if variant is [`Skip::None`]. - fn is_none(&self) -> bool { + pub fn is_none(&self) -> bo...
13
65
59
d16a985beff4e4abe9bc53caa3200a85d5b67288
daxpedda
2021-12-03T21:03:32
Add test for enums with all kind of variants
diff --git a/tests/enum_mixed.rs b/tests/enum_mixed.rs new file mode 100644 index 0000000..79d1719 --- /dev/null +++ b/tests/enum_mixed.rs @@ -0,0 +1,111 @@ +#![allow(clippy::clone_on_copy)] + +#[macro_use] +mod util; + +use std::{ + collections::hash_map::DefaultHasher, + hash::{Hash, Hasher}, +}; + +use derive_where:...
1
111
0
247d70d9db98b5ad26f9c3caa8376191d6c31c87
daxpedda
2021-12-03T21:02:56
Fix nightly implementation of `PartialOrd` and `Ord`
diff --git a/src/test/basic.rs b/src/test/basic.rs index e788bb6..f567c29 100644 --- a/src/test/basic.rs +++ b/src/test/basic.rs @@ -197,8 +197,8 @@ fn tuple() -> Result<()> { fn enum_() -> Result<()> { #[cfg(feature = "nightly")] let discriminant = quote! { - let __self_disc = ::core::intrinsics::discriminant_va...
3
12
12
dad5a2b9e4e48d29716563ed04a2592832f6ace6
daxpedda
2021-12-03T20:09:41
Fix MSRV build
diff --git a/ensure-no-std/Cargo.toml b/ensure-no-std/Cargo.toml index 6f40599..8045992 100644 --- a/ensure-no-std/Cargo.toml +++ b/ensure-no-std/Cargo.toml @@ -7,11 +7,11 @@ version = "0.0.0" [features] nightly = ["derive-where/nightly"] safe = ["derive-where/safe"] -zeroize = ["derive-where/zeroize"] +zeroize = ["...
2
3
2
d1ee090a67f5b1a1ef721692426fc2690d68121c
daxpedda
2021-12-03T19:54:04
Implement all traits for ensure-no-std
diff --git a/ensure-no-std/Cargo.toml b/ensure-no-std/Cargo.toml index b85422e..6f40599 100644 --- a/ensure-no-std/Cargo.toml +++ b/ensure-no-std/Cargo.toml @@ -11,6 +11,7 @@ zeroize = ["derive-where/zeroize"] [dependencies] derive-where = { path = ".." } +zeroize_ = { version = "1", package = "zeroize", default-fe...
2
6
4
bef11bee8301592294d32fac8652050efaf5d97e
daxpedda
2021-12-03T19:53:50
Fix skipping all fields for some traits
diff --git a/src/trait_/common_ord.rs b/src/trait_/common_ord.rs index 7f65938..a58c843 100644 --- a/src/trait_/common_ord.rs +++ b/src/trait_/common_ord.rs @@ -140,6 +140,9 @@ pub fn build_ord_signature(item: &Item, trait_: &DeriveTrait, body: &TokenStream } } } + Item::Item(data) if data.is_empty(trait_)...
3
19
7
092c5d9ed79591aeda2f2426b00a303b7209b4b1
daxpedda
2021-12-03T16:33:45
Fix MSRV testing
diff --git a/tests/enum_struct.rs b/tests/enum_struct.rs index acf2e9a..3cc384e 100644 --- a/tests/enum_struct.rs +++ b/tests/enum_struct.rs @@ -1,5 +1,6 @@ #![allow(clippy::clone_on_copy)] +#[macro_use] mod util; use std::{ diff --git a/tests/enum_tuple.rs b/tests/enum_tuple.rs index ea132d3..0427ea2 100644 ---...
2
2
0
ad8d263f82ff62996121b0751dbea40b439aa566
daxpedda
2021-12-03T16:27:26
Fix MSRV testing
diff --git a/tests/enum_struct.rs b/tests/enum_struct.rs index 35fbb79..acf2e9a 100644 --- a/tests/enum_struct.rs +++ b/tests/enum_struct.rs @@ -14,16 +14,6 @@ use self::util::{ AssertPartialOrd, Wrapper, }; -// Copied from std. -macro_rules! matches { - ($expression:expr, $(|)? $( $pattern:pat_param )|+ $( if ...
3
11
20
baeaeccde8e66760b98344181d0628779b87cada
daxpedda
2021-12-03T16:23:58
Don't use `core` unless we are in a `no_std` context
diff --git a/non-msrv-tests/tests/ui/default.rs b/non-msrv-tests/tests/ui/default.rs index 20eb349..50b0580 100644 --- a/non-msrv-tests/tests/ui/default.rs +++ b/non-msrv-tests/tests/ui/default.rs @@ -1,4 +1,4 @@ -use core::marker::PhantomData; +use std::marker::PhantomData; use derive_where::DeriveWhere; diff --g...
41
85
79
d119c4245431dbda4939a8ffb85ca7016c2e977f
daxpedda
2021-12-02T18:31:00
Add tests to check if all bounds are added correctly
diff --git a/src/test/bound.rs b/src/test/bound.rs index 364e880..9a3265d 100644 --- a/src/test/bound.rs +++ b/src/test/bound.rs @@ -138,3 +138,253 @@ fn associated_type_custom_bound() -> Result<()> { }, ) } + +#[test] +fn check_trait_bounds() -> Result<()> { + test_derive( + quote! { + #[derive_where(Clone, C...
1
250
0
f1e447aba6c9114518a9f0ab2051614367c40672
daxpedda
2021-12-02T18:01:31
Implement more error cases
diff --git a/src/attr/field.rs b/src/attr/field.rs index 5748569..b24839b 100644 --- a/src/attr/field.rs +++ b/src/attr/field.rs @@ -48,6 +48,10 @@ impl FieldAttr { debug_assert!(meta.path().is_ident(DERIVE_WHERE)); if let Meta::List(list) = meta { + if list.nested.is_empty() { + return Err(Error::empty(li...
7
66
13
7cfcab5e34e3792c14d02fa9a0b2cdb79398200e
daxpedda
2021-12-02T14:38:21
Fix linting
diff --git a/src/input.rs b/src/input.rs index c74eb61..2343b5f 100644 --- a/src/input.rs +++ b/src/input.rs @@ -3,9 +3,10 @@ use proc_macro2::Span; use syn::{DeriveInput, GenericParam, Generics, Result, Type, TypePath}; +#[cfg(feature = "zeroize")] +use crate::DeriveTrait; use crate::{ - Data, Default, DeriveTrai...
1
3
2
df0cdf357e5017863e83d38d93b103a1fd6b54c0
daxpedda
2021-12-02T14:24:27
Add error when generics are the same as on the item to recommend using standard instead
diff --git a/ensure-no-std/src/lib.rs b/ensure-no-std/src/lib.rs index 3e54350..b78d72d 100644 --- a/ensure-no-std/src/lib.rs +++ b/ensure-no-std/src/lib.rs @@ -1,7 +1,9 @@ #![no_std] +use core::marker::PhantomData; + // TODO: ensure more things then just `Clone`. #[derive(derive_where::DeriveWhere)] -#[derive_w...
17
398
180
bc0814193956333a530da7c84eaf79d05bab23c1
daxpedda
2021-12-01T02:36:36
Re-introduce bound tests - Fix implementing multiple traits without bound. - Add error when using `skip` without implementing relevant traits
diff --git a/src/attr/field.rs b/src/attr/field.rs index 96cc0e9..5748569 100644 --- a/src/attr/field.rs +++ b/src/attr/field.rs @@ -2,7 +2,7 @@ use syn::{spanned::Spanned, Attribute, Meta, NestedMeta, Result}; -use crate::{Error, Skip, Trait, DERIVE_WHERE}; +use crate::{DeriveWhere, Error, Skip, Trait, DERIVE_WHE...
10
177
434
14fa575117e44d0c313f9fc33a85854d8eb514e1
daxpedda
2021-12-01T00:46:05
Improve `Member` `Display` implementation
diff --git a/src/data/field.rs b/src/data/field.rs index 35f2733..c4a5193 100644 --- a/src/data/field.rs +++ b/src/data/field.rs @@ -48,8 +48,8 @@ impl ToTokens for Member<'_> { impl Display for Member<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { - Member::Named(ident) => f.write_fmt...
1
2
2
dd19fc3c74dd81e9a9bb86ed0ea1440c4a8b8f30
daxpedda
2021-11-30T12:57:46
Split "main" in multiple smaller functions
diff --git a/src/lib.rs b/src/lib.rs index 0574325..fa53ac0 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ use core::iter; use proc_macro2::TokenStream; use quote::quote; use syn::{ - punctuated::Punctuated, spanned::Spanned, DeriveInput, PredicateType, Result, Token, + punctuated::Punctuated, span...
1
77
66
8a1446cc378abeea10fd475bdee2382312443c95
daxpedda
2021-11-30T01:40:04
Consolidate methods
diff --git a/src/data.rs b/src/data.rs index e3b3a2b..db060dd 100644 --- a/src/data.rs +++ b/src/data.rs @@ -3,9 +3,10 @@ mod field; mod fields; -use syn::{FieldsNamed, FieldsUnnamed, Ident, Pat, PatPath, Path, Result}; +use proc_macro2::Span; +use syn::{FieldsNamed, Ident, Pat, PatPath, Path, Result}; -use crate...
2
84
113
fa7dbdefe400d21cdc3b702e2fab094272c143b4
daxpedda
2021-11-30T01:29:59
Move `Item`
diff --git a/src/input.rs b/src/input.rs index f38ea51..5cc3f5f 100644 --- a/src/input.rs +++ b/src/input.rs @@ -1,36 +1,20 @@ -//! Saves an intermediate representation of the input. +//! Parses [`DeriveInput`] into something more useful. use proc_macro2::Span; -use syn::{DeriveInput, Fields, Generics, Ident, Result...
3
87
80
92262db204fa35fe3db66340abe54be9a3e4fe9e
daxpedda
2021-11-30T01:20:49
Move `main`
diff --git a/src/lib.rs b/src/lib.rs index a9390c4..1e2b405 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,6 +34,16 @@ use util::Either; /// Token used for attributes. const DERIVE_WHERE: &str = "derive_where"; +/// TODO +#[proc_macro_derive(DeriveWhere, attributes(derive_where))] +#[cfg_attr(feature = "nightly", ...
1
10
10
bec1113955002b9edc3333afd6f4fe72e16aa49a
daxpedda
2021-11-30T01:19:57
Remove `mod impl_`
diff --git a/src/impl_.rs b/src/impl_.rs deleted file mode 100644 index 8804625..0000000 --- a/src/impl_.rs +++ /dev/null @@ -1,100 +0,0 @@ -//! `impl` generation implementation. - -use proc_macro2::TokenStream; -use quote::quote; -use syn::{punctuated::Punctuated, PredicateType, Token, WhereClause, WherePredicate}; - ...
12
151
143
8b726c9c422b0403e9835ae50d984fac2457d942
ModProg
2021-11-27T16:14:09
trying to make it build with different features
diff --git a/src/attr.rs b/src/attr.rs index 7076d4e..8c1e115 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -5,6 +5,7 @@ mod field; mod item; mod skip; mod variant; +#[cfg(feature = "zeroize")] mod zeroize_fqs; use default::Default; diff --git a/src/attr/field.rs b/src/attr/field.rs index 8501614..10fd338 100644...
5
153
148
70195adb092bfe6d746c50ac6fc80430aa3e8083
ModProg
2021-11-27T14:24:36
disable zeroize import without feature
diff --git a/src/attr.rs b/src/attr.rs index 65f22cc..7076d4e 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -12,4 +12,5 @@ pub use field::FieldAttr; pub use item::{DeriveTrait, DeriveWhere, ItemAttr}; use skip::Skip; pub use variant::VariantAttr; +#[cfg(feature = "zeroize")] use zeroize_fqs::ZeroizeFqs;
1
1
0
5d8025a084013e82024e87dad34eba5e178c5b95
daxpedda
2021-11-25T16:02:52
Generate correct code for `PartialEq` skipping variants
diff --git a/Cargo.toml b/Cargo.toml index a7d57c8..06e85ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ quote = { version = "1", default-features = false } syn = { version = "1", default-features = false, features = [ "clone-impls", "derive", + "full", "parsing", "printing", ] } diff --git a/sr...
8
131
18
c8074a26cc9c5a8708c417c638065d68263ae157
daxpedda
2021-11-14T08:08:46
Rename `__AssertParamIsCopy` to `__AssertCopy`
diff --git a/src/lib.rs b/src/lib.rs index 31d2ca4..7de5c8a 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1145,8 +1145,8 @@ impl Trait { Clone => Ok(quote! { #[inline] fn clone(&self) -> Self { - struct __AssertParamIsCopy<__T: ::core::marker::Copy + ?::c...
1
4
4
9dd1631249e4f6c8d23fb733bd24374487cce3ba
daxpedda
2021-11-14T07:59:56
Extract attribute token to global variable
diff --git a/src/lib.rs b/src/lib.rs index a8ff526..31d2ca4 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,6 +22,9 @@ use syn::{ WhereClause, WherePredicate, }; +/// Token used for attributes. +const DERIVE_WHERE: &str = "derive_where"; + /// Holds a single generic [type](Type) or [type with bound](PredicateT...
1
5
2
78b9b91fe64ff94275bb21d02a8416e4f683fa76
daxpedda
2021-11-14T07:54:48
Fix tests and crate feature compilation
diff --git a/src/lib.rs b/src/lib.rs index a134b00..a8ff526 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,17 +10,17 @@ extern crate proc_macro; use proc_macro2::{Ident, Span, TokenStream}; use quote::{format_ident, quote, ToTokens}; +#[cfg(feature = "zeroize")] +use syn::Lit; use syn::{ parse::{discouraged:...
1
13
13
0e8d9b3d4f98df7ed6f4b391e7bab62a487cf8e5
daxpedda
2021-11-11T17:51:14
Start implementing integration tests
diff --git a/tests/tests.rs b/tests/tests.rs index c772bc7..c96437a 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1,145 +1,113 @@ -#![allow(dead_code)] +#![allow(clippy::clone_on_copy)] -use core::marker::PhantomData; +use std::collections::hash_map::DefaultHasher; +use core::hash::{Hash, Hasher}; +use core::f...
2
248
135
60f2007502a4934d7b9b2cc966bebb45a5c091eb
daxpedda
2021-11-10T14:18:23
Improve empty struct or tuple variant and add tests
diff --git a/src/lib.rs b/src/lib.rs index dc4c05f..85c33bc 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -505,12 +505,11 @@ impl Trait { // If there is any unit variant, return `true` in the `_` pattern. // `matches!` was added in 1.42.0. #[allow(clippy::match_like_matc...
1
298
62
de3e6c82b02f59e8a3a4f99f4b0cdcb0297ae6c4
daxpedda
2021-11-10T13:18:01
Improve `PartialEq`
diff --git a/src/lib.rs b/src/lib.rs index 537ae7e..dc4c05f 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -904,11 +904,8 @@ impl Trait { } } PartialEq => quote! { - (#pattern { #(#fields: ref #fields_temp),* }, #pattern { #(#fields: ref #fields_other),* }) => { - ...
1
20
50
be67dbf278aeb35cd0a77fe033ee07410000b4bc
daxpedda
2021-11-10T13:03:07
Code de-duplication
diff --git a/src/lib.rs b/src/lib.rs index 02decb1..537ae7e 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -609,7 +609,7 @@ impl Trait { quote! { unreachable!("comparing variants yielded unexpected results") } }; - #[cfg(feature = "nightly")] + #[cfg(an...
1
3
11
8611ceb31dcd9e1bbd91738a7112132f730f5ae7
daxpedda
2021-11-10T08:42:04
Implement `Zeroize` trait
diff --git a/Cargo.toml b/Cargo.toml index 15c38e2..fa26e11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ proc-macro = true [features] nightly = [] safe = [] +zeroize = [] [dependencies] proc-macro2 = { version = "1", default-features = false, features = ["proc-macro"] } @@ -32,3 +33,4 @@ syn = { ve...
3
70
0
92ea9337f9d60e462841fa5e5baafc5b719d8fe8
daxpedda
2021-11-10T08:41:33
Add `resolver = "2"` because we aren't on Rust edition 2021 anymore
diff --git a/Cargo.toml b/Cargo.toml index 5eb08f0..15c38e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ include = [ "LICENSE-*", "README.md" ] +resolver = "2" [lib] proc-macro = true
1
1
0
422fb955e86bb520910ca12cdd7a548163997a49
daxpedda
2021-11-09T14:29:03
Improve warning circumvention
diff --git a/src/lib.rs b/src/lib.rs index 50d57f9..8cf294c 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -313,8 +313,7 @@ impl Trait { // Rust 1.36.0 doesn't support attributes on parameters. #[cfg(any(feature = "nightly", not(feature = "safe")))] - #[allow(clippy::drop_ref)] - core::me...
1
1
2
ac10d28285d51893ce116700f38b5da1e3a654f8
daxpedda
2021-11-09T14:25:16
Implement `nightly` crate feature
diff --git a/src/lib.rs b/src/lib.rs index abf15d1..50d57f9 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unsafe_code)] +#![cfg_attr(feature = "nightly", feature(allow_internal_unstable))] #![warn(clippy::cargo, clippy::missing_docs_in_private_items)] #![cfg_attr(doc, warn(rustdoc::all), allow(rus...
1
92
24
c4c76bf7d85486c4b176144a0f45f3f950f92b5e
daxpedda
2021-11-09T13:00:54
Remove unnecessary unit value
diff --git a/src/lib.rs b/src/lib.rs index 505c5b8..abf15d1 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -768,7 +768,6 @@ impl Trait { quote! { #pattern => { #discriminant - () } } } Ord => quote! {}, @@ -1230,7 +1229,6...
1
0
2
4fd5c727cd79ab70f8f257cf7bfdf0b5556214fd
daxpedda
2021-11-09T12:53:25
Restore MSRV
diff --git a/src/lib.rs b/src/lib.rs index c82aaa7..505c5b8 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -304,13 +304,16 @@ impl Trait { /// Build signature for [`PartialOrd`] and [`Ord`]. fn build_ord_signature( self, - #[cfg(not(feature = "safe"))] _name: &Ident, - #[cfg(feature = "saf...
1
6
3
17433f634c80eaeb21d3bf5b4d32b419cf9a9938
daxpedda
2021-11-09T12:47:47
Fix `Ord` and `PartialOrd` implementation
diff --git a/src/lib.rs b/src/lib.rs index 68cae3f..c82aaa7 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -385,8 +385,8 @@ impl Trait { } } else { #path::#method( - &::core::mem::transmute::<_, isize>(__self_...
2
30
10
f06791449bf68dd1a18d592da7f9b1b4d773b2a5
daxpedda
2021-11-09T12:38:06
Add another test to make sure everything remains the same
diff --git a/tests/safety.rs b/tests/safety.rs index d3d294b..cb56a09 100644 --- a/tests/safety.rs +++ b/tests/safety.rs @@ -1,6 +1,6 @@ #[test] fn discriminant() { - use core::mem::{discriminant, transmute}; + use core::mem::{discriminant, size_of, size_of_val, transmute}; enum Test { A, @@ -8,...
1
3
1
392eed1a8c19ceb0a51ffbccc6618ce9bb7f552d
daxpedda
2021-11-09T12:27:07
Implement unsafe version of `PartialOrd` and `Ord`
diff --git a/Cargo.toml b/Cargo.toml index 7db8133..5eb08f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ include = [ proc-macro = true [features] +nightly = [] safe = [] [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 06b85df..68cae3f 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,8 +7,6...
4
247
130
74471cb81a320cc306b1a0d8f7449f8d136b7d01
daxpedda
2021-11-09T11:51:21
Implement safe alternative
diff --git a/Cargo.toml b/Cargo.toml index f7b4710..7db8133 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,9 @@ include = [ [lib] proc-macro = true +[features] +safe = [] + [dependencies] proc-macro2 = { version = "1", default-features = false, features = ["proc-macro"] } quote = { version = "1", default-...
2
45
19
b42f12bb6967ac19f7338b2538bfbae5ebfc3c42
daxpedda
2021-11-09T10:04:21
Do some spellchecking
diff --git a/src/lib.rs b/src/lib.rs index 34d6b45..3b90404 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,8 +32,8 @@ impl Parse for Generic { fn parse(input: ParseStream) -> Result<Self> { let fork = input.fork(); - // Try to parse input as a WherePredicate. The problem is, both expresions - ...
1
6
6
7a16715d50239981eef5b678cfdcb6a7272f1d98
daxpedda
2021-11-09T09:52:21
Add `#[inline]` to signatures according to the standard derive implementation
diff --git a/src/lib.rs b/src/lib.rs index 79edda8..34d6b45 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -425,6 +425,7 @@ impl Trait { match self { Clone => quote! { + #[inline] fn clone(&self) -> Self { match self { #b...
1
27
0
31df5dcc51bf5bf161ff034503f00dc1fcc43885
daxpedda
2021-11-09T08:38:47
Only convert to string when absolutely necessary
diff --git a/src/lib.rs b/src/lib.rs index ce71cf6..73a9046 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -592,7 +592,6 @@ impl Trait { use Trait::*; let path = self.path(); - let debug_name = debug_name.to_string(); // Build temporary de-structuring variable names from field indexes...
1
15
10
8b934c4871aa7506d748c755fbadea0f47573034
daxpedda
2021-11-09T08:26:27
Improve structure to prevent duplicate code
diff --git a/src/lib.rs b/src/lib.rs index 8cae933..ce71cf6 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -173,15 +173,17 @@ impl Trait { /// Generate `impl` item body. fn generate_body(self, name: &Ident, data: &Data) -> Result<TokenStream> { - let body = match &data { + match data { ...
1
55
40
36c0472f04cdbe27349e75ac1455b2c3ad9c8fc8
daxpedda
2021-11-08T20:54:42
Improve `Ord` and `PartialOrd` implementation to be closer to `std`s derive
diff --git a/src/lib.rs b/src/lib.rs index 146f942..8cae933 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -178,12 +178,8 @@ impl Trait { let pattern = name.into_token_stream(); match &data.fields { - Fields::Named(fields) => { - self.build_for_...
1
348
246
5084780c2432bb3f22235766fdeedbb425451164
daxpedda
2021-11-04T14:01:55
Add tests for edge-cases
diff --git a/src/lib.rs b/src/lib.rs index ac2c11a..146f942 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1147,7 +1147,7 @@ mod test { } #[test] - fn enum_one_data() -> Result<()> { + fn enum_eq_one_data() -> Result<()> { test_derive( quote! { PartialEq; T }, quote! {...
1
99
3
dadfc71be5814b95e8579802cad55b6694549e0d
dAxpeDDa
2021-11-03T13:46:01
Address review comments
diff --git a/src/lib.rs b/src/lib.rs index a963049..66e5e82 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -616,8 +616,8 @@ impl Trait { Hash => { // Add hashing the variant if this is an `enum`. let discriminant = if variants.is_some() { - let type_ = self...
1
2
2
63b9ec40bf44a9ffaf8dcd313d7aa4d6d9026f43
dAxpeDDa
2021-11-03T13:39:10
Adjust MSRV, enable MSRV testing and reduce dependencies
diff --git a/Cargo.toml b/Cargo.toml index 74c919c..f7b4710 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "derive-where" version = "0.1.0" edition = "2018" -rust-version = "1.33.0" +rust-version = "1.36.0" description = "Deriving with custom trait bounds" documentation = "https://docs.rs/derive-w...
2
23
12
db2e0f8d0047aba7a8cccd434d33a830db4dfc3e
dAxpeDDa
2021-11-03T02:12:42
Run rustfmt
diff --git a/src/lib.rs b/src/lib.rs index 3db5896..144a549 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,7 +53,10 @@ impl Parse for Generic { } Err(_) => match Type::parse(input) { Ok(type_) => Ok(Self::NoBound(type_)), - Err(error) => Err(Error::new(error.sp...
1
4
1
f378a9720f930fd373a86cefc17ca4f2014b5ab6
dAxpeDDa
2021-11-02T23:16:31
Improve `PartialEq` implementation for `enum`s
diff --git a/src/lib.rs b/src/lib.rs index 1bde632..bad5f14 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -343,14 +343,24 @@ impl Trait { } }, PartialEq => { - let body = if let Data::Enum(..) = data { + let body = if let Data::Enum(data) = data { +...
1
15
6
42baccf535ae12a43e1986a92c246c0770d331ee
daxpedda
2021-11-01T18:39:22
Convert errors instead of taking a reference
diff --git a/src/lib.rs b/src/lib.rs index c2e5926..bb8a21a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -664,7 +664,7 @@ pub fn derive_where( // Redirect to `derive_where_internal`, this only convert the error appropriately. match derive_where_internal(attr.into(), item.into()) { Ok(output) => output...
1
1
1
8ed5987ba15127c75ffc366dcf6c62215f4090c8
ModProg
2021-11-02T23:06:39
Move generics split out of trait loop
diff --git a/src/lib.rs b/src/lib.rs index 9c6e112..4d4c636 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -599,14 +599,14 @@ fn derive_where_internal(attr: TokenStream, item: TokenStream) -> Result<TokenSt .. } = syn::parse2(item)?; + // Build necessary generics to construct the implementation item. + ...
1
3
3
bc6b632f81aaf069572800b7479a8800b736bc42
ModProg
2021-11-02T20:15:55
Build where clause instead of quote
diff --git a/src/lib.rs b/src/lib.rs index f2e767a..711ab24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,13 +10,14 @@ extern crate proc_macro; use core::cmp::Ordering; use proc_macro2::{Ident, TokenStream}; -use quote::{format_ident, quote, ToTokens}; +use quote::{format_ident, quote}; use syn::{ parse::{d...
1
65
51