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
23a3b7b0641252378c36e2797b74c7e28262a56a
Ted Driggs
2022-03-03T17:16:55
Don't panic in Ident::from_string
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index e961dda..1651331 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -243,7 +243,7 @@ from_meta_float!(f64); /// emitted span. impl FromMeta for syn::Ident { fn from_string(value: &str) -> Result<Self> { - Ok(syn::Ident::new(va...
1
1
1
c0949f93ec56ca9625914a21978f523a1d6f4b59
Ted Driggs
2022-03-02T21:50:34
Preserve span information on FromMeta for syn
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index 8d775dd..e961dda 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -371,6 +371,14 @@ impl FromMeta for syn::WhereClause { fn from_string(value: &str) -> Result<Self> { syn::parse_str(value).map_err(|_| Error::unknown_value(va...
1
20
0
dbdcd93d0e78d3078f5fe148f7824fe1fe310368
Ted Driggs
2022-01-07T19:32:58
Fix broken link in docs
diff --git a/src/lib.rs b/src/lib.rs index 247c0e3..2429c7c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ //! //! //! ## Design -//! Darling takes considerable design inspiration from [`serde`]. A data structure that can be +//! Darling takes considerable design inspiration from [`serde`](https://serde.rs...
1
1
1
972a9e6ef3d77c259c77b9cde8060ff2326a6e8a
Ted Driggs
2022-01-07T18:59:37
Extract path_to_string to an exported function.
diff --git a/core/src/codegen/from_meta_impl.rs b/core/src/codegen/from_meta_impl.rs index a66de7b..24ccc57 100644 --- a/core/src/codegen/from_meta_impl.rs +++ b/core/src/codegen/from_meta_impl.rs @@ -98,7 +98,7 @@ impl<'a> ToTokens for FromMetaImpl<'a> { 0 => ::darling::export::Err(::darli...
7
46
31
926fed1922e01f5feae5a7a80d3885f90963f28a
Ted Driggs
2021-12-07T14:12:49
Fix remaining cases of dead code warnings in tests
diff --git a/examples/consume_fields.rs b/examples/consume_fields.rs index 339f15b..706f228 100644 --- a/examples/consume_fields.rs +++ b/examples/consume_fields.rs @@ -1,3 +1,7 @@ +// The use of fields in debug print commands does not count as "used", +// which causes the fields to trigger an unwanted dead code warnin...
9
24
0
e2300723fe793c8c705af32f17267e898cd89513
Ted Driggs
2021-12-07T13:56:53
Fix unused field warning in integration test
diff --git a/tests/supports.rs b/tests/supports.rs index 29c097e..ae3f2f7 100644 --- a/tests/supports.rs +++ b/tests/supports.rs @@ -3,6 +3,8 @@ use darling::{ast, FromDeriveInput, FromVariant}; #[derive(Debug, FromDeriveInput)] #[darling(attributes(from_variants), supports(enum_any))] pub struct Container { + //...
1
8
2
e89411a297f40ded8defb1b94efc77e493fa8495
Ted Driggs
2021-11-29T16:45:29
Add FromAttributes trait and macro (#152) With a proliferation of items that support proc-macros, it's not sustainable to create a trait and `darling::ast` type to represent each one. The `FromAttributes` trait is a middle ground; it gives macro authors access to darling's attribute parsing and error handling logic, w...
diff --git a/core/src/codegen/attr_extractor.rs b/core/src/codegen/attr_extractor.rs index a9b8715..3102024 100644 --- a/core/src/codegen/attr_extractor.rs +++ b/core/src/codegen/attr_extractor.rs @@ -21,6 +21,14 @@ pub trait ExtractAttribute { /// Gets the name used by the generated impl to return to the `syn` it...
10
239
4
18caa2861eae6bb4ef82b2a256c7bba4cb8f66c8
Ted Driggs
2021-08-03T13:57:35
Add example for util::Override Fixes #139
diff --git a/examples/shorthand_or_long_field.rs b/examples/shorthand_or_long_field.rs new file mode 100644 index 0000000..14c4dfd --- /dev/null +++ b/examples/shorthand_or_long_field.rs @@ -0,0 +1,76 @@ +//! Example showing potentially-nested meta item parsing with `darling::util::Override`. +//! +//! Based on https:/...
1
76
0
955162b53d933f9cb5003c457dd849255c1e75ac
Ted Driggs
2021-08-03T13:22:20
Fix clippy::needless-borrow lint failures (#142) * Fix clippy::needless-borrow lint failures * Remove unused ident in tests (unclear why this wasn't an issue before, but removing it is clearly fine) Fixes #141
diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs index d21d791..fd4a944 100644 --- a/core/src/codegen/from_derive_impl.rs +++ b/core/src/codegen/from_derive_impl.rs @@ -112,7 +112,7 @@ impl<'a> ToTokens for FromDeriveInputImpl<'a> { impl<'a> ExtractAttribute for FromDeriveInpu...
11
12
13
cf33114da1001fef5a8cdaec3e6d3fa1a3112ba8
Ted Driggs
2021-06-24T17:03:35
Fix clippy::bool_assert_comparison (#138) Clippy prefers the use of `assert` over `assert_eq` with booleans. In some cases that's a fine swap, in others we want to keep it as-is and so instead disable the lint.
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index 799df0e..1d86b28 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -605,6 +605,7 @@ mod tests { } #[test] + #[allow(clippy::bool_assert_comparison)] fn bool_succeeds() { // word format assert_eq!(fm::<...
5
11
7
efcfa073b096b10db998dedd30b3bbb0b939981d
Ted Driggs
2021-05-20T17:38:12
Bump version to 0.13.0
diff --git a/Cargo.toml b/Cargo.toml index 26b7453..b4bf888 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "darling" -version = "0.13.0-beta" +version = "0.13.0" authors = ["Ted Driggs <ted.driggs@outlook.com>"] repository = "https://github.com/TedDriggs/darling" -documentation = "https:/...
3
7
7
63377d12ebba4a986d45e82f3b23995287771778
Ted Driggs
2021-04-20T23:01:59
Error on duplicate fields in fields and variants Fixes #56
diff --git a/core/src/options/input_field.rs b/core/src/options/input_field.rs index f47d535..39989b0 100644 --- a/core/src/options/input_field.rs +++ b/core/src/options/input_field.rs @@ -14,9 +14,9 @@ pub struct InputField { /// If `true`, generated code will not look for this field in the input meta item, ...
2
44
13
f91921281ec0a32ac5c106b410421729c69ba9dc
Ted Driggs
2021-04-20T22:25:28
Update dependencies
diff --git a/Cargo.toml b/Cargo.toml index d64c9c1..b62409e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,9 @@ darling_core = { version = "=0.12.4", path = "core" } darling_macro = { version = "=0.12.4", path = "macro" } [dev-dependencies] -proc-macro2 = "1" -quote = "1" -syn = "1" +proc-macro2 = "1.0.26" +...
3
10
10
0add687a1145298d4f6b5d55458ff71348b67504
Ted Driggs
2021-04-20T21:37:14
Update to 2018 * Fix relative visibility in darling_core * Fix imports to use crate:: * Remove most unnecessary `#[macro_use]` and `extern crate` lines * Fix all warnings in tests and examples * Add self:: to core/lib.rs to compile on 1.31.0 First step of #127
diff --git a/Cargo.toml b/Cargo.toml index fcf560a..d64c9c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ implementing custom derives. """ license = "MIT" readme = "README.md" +edition = "2018" exclude = ["/.travis.yml", "/publish.sh", "/.github/**"] [badges] diff --git a/core/Cargo.toml b/core/Carg...
79
191
357
56542d24499ec075c52f3ec9f028c090b6179a66
Ted Driggs
2021-04-20T19:11:14
Bump version to 0.12.4
diff --git a/Cargo.toml b/Cargo.toml index a516ffd..fcf560a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "darling" -version = "0.12.3" +version = "0.12.4" authors = ["Ted Driggs <ted.driggs@outlook.com>"] repository = "https://github.com/TedDriggs/darling" -documentation = "https://docs...
3
7
7
3b03d929aa9bdb69617cf0c6625ae5c0a09c5c22
Oleksandr Kryvytskyi
2021-04-08T13:55:09
Fix FromMeta for chars (#126) * Fix FromMeta for char * Get rid of unwrap in from_string impl for char Co-authored-by: Veetaha <veetaha2@gmail.com> Co-authored-by: Oleksandr Kryvytskyi <okryvytskyi@elastio.com>
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index 507edda..f22b5a9 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -25,6 +25,10 @@ use {Error, Result}; /// * As a boolean literal, e.g. `foo = true`. /// * As a string literal, e.g. `foo = "true"`. /// +/// ## char +/// * As a char lit...
1
32
0
7152c53dd209eefd745c5316af288048e924fcc2
Ted Driggs
2021-02-24T14:49:08
Collect all errors in FromMeta for HashMap darling's general error philosophy is that because compile times are long, it's better to identify as many errors as possible when darling is invoked. This saves devs using darling-powered macros from having to go through multiple compilation attempts to find everything wrong...
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index c735965..507edda 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -1,5 +1,7 @@ +use std::borrow::Cow; use std::cell::RefCell; -use std::collections::hash_map::{Entry, HashMap}; +use std::collections::hash_map::HashMap; +use std::collecti...
1
113
23
e7036556148e1265482cb174c24afb87d5026674
Ted Driggs
2021-02-23T22:30:11
Report error for misplaced literals in HashMaps Previously, these were ignored, which could have created some confusing non-error scenarios.
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index 8425fbf..c735965 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -447,21 +447,26 @@ macro_rules! hash_map { fn from_list(nested: &[syn::NestedMeta]) -> Result<Self> { let mut map = HashMap::with_capacity_and...
1
18
13
39a40120b9b18f70d586e2557bcef2ac968aaa5a
Ted Driggs
2021-02-23T22:25:12
Consolidate FromMeta HashMap impls Future improvements will now apply to all key types. This is done with a macro rather than a blanket impl to avoid forcing a minor version bump and to allow ongoing iteration of the key type requirements.
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index a59d119..8425fbf 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -406,90 +406,77 @@ impl<T: FromMeta> FromMeta for RefCell<T> { } } -impl<V: FromMeta, S: BuildHasher + Default> FromMeta for HashMap<String, V, S> { - fn from_li...
1
57
70
f6a4f6fdb4a4263e82d41ada1f6b914fa14a168c
Ted Driggs
2021-02-10T20:59:57
Don't panic on unions in darling_core
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index 5d9fb36..c31fe14 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -31,6 +31,20 @@ impl<V, F> Data<V, F> { } } + /// Creates an empty body of the same shape as the passed-in body. + /// + /// `darling` does not support...
8
27
13
2922dd5c8758ae4d351a09118d84b65d06f42734
Ted Driggs
2021-02-10T18:46:49
Remove use of unreachable for unions Fixes #85
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index 69a075e..5d9fb36 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -20,11 +20,14 @@ pub enum Data<V, F> { impl<V, F> Data<V, F> { /// Creates an empty body of the same shape as the passed-in body. + /// + /// # Panics + /// Th...
1
8
2
bd9ef62a9cd573184bcc82918f6b26a155069747
Ryan
2021-02-16T15:10:12
Impl FromMeta for ExprArray and some integer arrays Co-authored-by: Ryan Jennings <ryan@ryanj.net>
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index f196246..843908a 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -6,7 +6,7 @@ use std::sync::atomic::AtomicBool; use std::sync::Arc; use ident_case; -use syn::{self, Lit, Meta, NestedMeta}; +use syn::{self, Expr, Lit, Meta, NestedMet...
1
73
1
3232a9ba879ad3db6f85c431a8a3979ecd61e953
Ted Driggs
2021-01-05T15:33:50
NFC: Provide best practices for errors (#114) darling's errors are designed to make implementing great experiences easy; this commit is more explicit about how direct users of darling should leverage `darling::Error` for best results. Fixes #112
diff --git a/core/src/error/mod.rs b/core/src/error/mod.rs index dc43c0e..90f9103 100644 --- a/core/src/error/mod.rs +++ b/core/src/error/mod.rs @@ -26,6 +26,34 @@ pub type Result<T> = ::std::result::Result<T, Error>; /// /// Given that most errors darling encounters represent code bugs in dependent crates, /// the ...
1
28
0
49ffb27cd7a48092ed054347c038e197714c9020
TakaakiFuruse
2021-01-05T15:25:18
Fix deprecation warnings now that MSRV is 1.31.0 (#97) * fixed trim Both method calls are deprecated in 1.30.0 * added ```dyn``` The syntax is available from Rust 1.27.
diff --git a/core/src/error/mod.rs b/core/src/error/mod.rs index 7e58105..dc43c0e 100644 --- a/core/src/error/mod.rs +++ b/core/src/error/mod.rs @@ -383,7 +383,7 @@ impl StdError for Error { &self.kind.description() } - fn cause(&self) -> Option<&StdError> { + fn cause(&self) -> Option<&dyn StdErr...
2
3
3
68c1da070b528a922f8895c44f5242588cdf8afe
Ted Driggs
2021-01-04T17:08:48
NFC: Fix FromField#ident magic field docs Due to a copy-paste error, the docs said the type was syn::Ident; it's actually Option<syn::Ident>. Fixes #102
diff --git a/src/lib.rs b/src/lib.rs index a599266..f6df452 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,7 +43,7 @@ //! ### `FromField` //! |Field name|Type|Meaning| //! |---|---|---| -//! |`ident`|`syn::Ident`|The identifier of the passed-in field| +//! |`ident`|`Option<syn::Ident>`|The identifier of the passed-...
1
1
1
ee197e8d5edf2d3ed03d4cb9450caa43ca1d1032
Ted Driggs
2021-01-04T17:00:51
NFC: Fix FromVariant table headings in lib.rs The layout of the table was broken due to missing headings.
diff --git a/src/lib.rs b/src/lib.rs index 93cdd58..a599266 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,6 +57,7 @@ //! |`attrs`|`Vec<syn::Attribute>`|The forwarded attributes from the passed in type param. These are controlled using the `forward_attrs` attribute.| //! //! ### `FromVariant` +//! |Field name|Type|...
1
1
0
d128844d71445bef93c6449612d16d6dc28625e8
Fabio Valentini
2020-10-01T14:09:37
core/Cargo: bump strsim dependency (#103) 0.10 only added new features, no code changes are necessary.
diff --git a/core/Cargo.toml b/core/Cargo.toml index c0ee23f..79e2c7c 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -19,4 +19,4 @@ proc-macro2 = "1" quote = "1" syn = { version = "1.0.1", features = ["full", "extra-traits"] } fnv = "1.0.6" -strsim = { version = "0.9.0", optional = true } +strsim = { version ...
1
1
1
7615326025038c7f461f21705a5d6d494132faa4
sharksforarms
2020-07-29T19:50:58
Impl FromMeta for syn's Punctuated type (#98)
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index a9b13b8..f196246 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -231,6 +231,21 @@ impl FromMeta for syn::Ident { } } +/// Parsing support for punctuated. This attempts to preserve span information +/// when available, but also s...
1
24
0
367cf25af1a509db06654691739561f55f0a3002
sharksforarms
2020-03-23T20:54:54
use syn::Index::from on index in examples (#93) Co-authored-by: sharks <sharks@sharks>
diff --git a/examples/consume_fields.rs b/examples/consume_fields.rs index 4b0703f..4f9f21a 100644 --- a/examples/consume_fields.rs +++ b/examples/consume_fields.rs @@ -101,7 +101,10 @@ impl ToTokens for MyInputReceiver { let field_ident = f.ident .as_ref() .ma...
1
4
1
cc20fb2798ae4194142514c4c3674ad6379344d3
Lucas
2020-01-06T22:52:01
Added ToTokens for Fields<syn::Field> (#87)
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index a0c765c..69a075e 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -1,6 +1,8 @@ use std::{slice, vec}; -use syn; +use proc_macro2::{Span, TokenStream}; +use quote::ToTokens; +use syn::spanned::Spanned; use usage::{ self, IdentRefSet...
2
174
49
c86b2d7e5f08f60c1f310d9e89333906c3c948e6
Ben Boeckel
2019-10-29T21:29:38
syn: bump minimum to 1.0.1 (#83) This version introduces the `base10_parse` symbol used within the core crate.
diff --git a/core/Cargo.toml b/core/Cargo.toml index 45afc93..3a7bae3 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -17,6 +17,6 @@ suggestions = ["strsim"] ident_case = "1.0.0" proc-macro2 = "1" quote = "1" -syn = { version = "1", features = ["full", "extra-traits"] } +syn = { version = "1.0.1", features = [...
1
1
1
ab605ecd7642704f34ab922d091149e498744b25
Robin Krahl
2019-09-24T20:30:21
Fix compilation error in darling_core tests (#81) This patch fixes three compilation errors in the tests for darling_core by fixing a wrong variable name and replacing two calls to Result::ok_err with Result::map_err. Fixes #80.
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index 8e42653..5c80539 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -387,7 +387,7 @@ mod tests { /// parse a string as a syn::Meta instance. fn pm(tokens: TokenStream) -> ::std::result::Result<syn::Meta, String> { let att...
2
3
3
cd92bc74d08905f1029156e52acbd522a7c0ee36
Ted Driggs
2019-03-20T14:44:57
Remove deprecated items
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index 8ea42bd..a0c765c 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -16,9 +16,6 @@ pub enum Data<V, F> { Struct(Fields<F>), } -#[deprecated(since = "0.3.0", note = "this has been renamed to Data")] -pub type Body<V, F> = Data<V, F>; - ...
2
0
15
b179505a8d3b4c20489f3d118a7e0fc628b9ffde
Ted Driggs
2019-03-20T14:28:54
Add maintenance badge to main crate Fixes #69
diff --git a/Cargo.toml b/Cargo.toml index 19cd750..7d9afd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ exclude = ["/.travis.yml", "/publish.sh"] [badges] travis-ci = { repository = "TedDriggs/darling" } +maintenance = { status = "actively-developed" } [dependencies] darling_core = { version = "=...
1
1
0
4e4637143fe3cbd850864534bef4830525fc1782
Ted Driggs
2019-03-20T14:16:14
Make util::Override::as_mut return &mut T Fixes #66
diff --git a/core/src/util/over_ride.rs b/core/src/util/over_ride.rs index 668676c..5223a02 100644 --- a/core/src/util/over_ride.rs +++ b/core/src/util/over_ride.rs @@ -59,7 +59,7 @@ impl<T> Override<T> { /// Converts from `Override<T>` to `Override<&mut T>`. /// /// Produces a new `Override`, containing...
1
1
1
038614fd9118933be399c1687076afa8362ec8b5
Ted Driggs
2019-03-19T14:55:42
Make darling_core::{codegen, options} crate-private This will make internal refactoring easier going forward. This change also removes dead code exposed by making the crates private. Fixes #58
diff --git a/core/src/codegen/trait_impl.rs b/core/src/codegen/trait_impl.rs index a2fa989..2f4f4ae 100644 --- a/core/src/codegen/trait_impl.rs +++ b/core/src/codegen/trait_impl.rs @@ -27,16 +27,13 @@ impl<'a> TraitImpl<'a> { .collect() } - /// Get the type parameters which are used by non-skippe...
3
5
17
419dd5d7d00ebaa4be2c0b3952a377a9492f845e
Ted Driggs
2019-03-20T14:13:52
Fix test issues on rustc 1.18.0
diff --git a/core/src/error/mod.rs b/core/src/error/mod.rs index 74e7f88..4b5b198 100644 --- a/core/src/error/mod.rs +++ b/core/src/error/mod.rs @@ -110,7 +110,7 @@ impl Error { /// /// impl FromMeta for Foo { /// fn from_value(value: &Lit) -> Result<Self> { - /// if let Lit::Str(ref lit_s...
4
6
5
b8772b8b4bee82dbea32691baca6eef24271269e
Ted Driggs
2019-03-19T14:51:23
Improve darling_core::options::shape docs
diff --git a/core/src/options/shape.rs b/core/src/options/shape.rs index fe9f25f..7c27adb 100644 --- a/core/src/options/shape.rs +++ b/core/src/options/shape.rs @@ -1,9 +1,24 @@ +//! Types for "shape" validation. This allows types deriving `FromDeriveInput` etc. to declare +//! that they only work on - for example - st...
1
17
0
c00ed9e1f4d99ca34f582ff179b803f8a0ed3327
Ted Driggs
2019-03-19T14:32:24
Remove suggestions from default features They're not 1.18-compatible
diff --git a/Cargo.toml b/Cargo.toml index b8a78ba..2ea187e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ quote = "0.6" syn = "0.15.26" [features] -default = ["suggestions"] diagnostics = ["darling_core/diagnostics"] suggestions = ["darling_core/suggestions"]
1
0
1
d9b46360209024bec739b9dc1f5f9db78f2b29cf
Ted Driggs
2019-03-19T14:28:13
Enable suggestions by default
diff --git a/Cargo.toml b/Cargo.toml index 67cd376..b8a78ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,8 +25,9 @@ quote = "0.6" syn = "0.15.26" [features] -diagnostics = [ "darling_core/diagnostics" ] -suggestions = [ "darling_core/suggestions" ] +default = ["suggestions"] +diagnostics = ["darling_core/diagnos...
1
3
2
32d298f31c1837cacca6a2be64cedd13bb767df3
Igor Gnatenko
2019-03-18T20:07:58
chore: Exclude unneeded files from crates.io (#65)
diff --git a/Cargo.toml b/Cargo.toml index 0adf232..2ecf407 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ implementing custom derives. """ license = "MIT" readme = "README.md" +exclude = ["/.travis.yml", "/publish.sh"] [badges] travis-ci = { repository = "TedDriggs/darling" }
1
1
0
3c3d9a8224a164a5b8604a784381849caa32f034
Ted Driggs
2019-02-12T17:58:35
Add suggestion support for variants
diff --git a/core/src/codegen/from_meta_impl.rs b/core/src/codegen/from_meta_impl.rs index 94b85d5..06add97 100644 --- a/core/src/codegen/from_meta_impl.rs +++ b/core/src/codegen/from_meta_impl.rs @@ -80,6 +80,17 @@ impl<'a> ToTokens for FromMetaImpl<'a> { let unit_arms = variants.iter().map(Variant::a...
2
16
1
2e830a3dead9a0b46bea51ed153e32eb3be0b7d9
Ted Driggs
2019-02-12T17:55:53
Fix compile errors when diagnostics feature enabled The code was accidentally moving `kind` out of the error before attempting to render the error to a string.
diff --git a/core/src/error/kind.rs b/core/src/error/kind.rs index 183443b..92d4afe 100644 --- a/core/src/error/kind.rs +++ b/core/src/error/kind.rs @@ -130,8 +130,11 @@ impl ErrorUnknownField { } #[cfg(feature = "diagnostics")] - pub fn to_diagnostic(self, span: Option<Span>) -> ::proc_macro::Diagnostic...
2
7
4
eaf79889961d89addcce72cb9e288ab94b007954
Ted Driggs
2019-02-12T15:08:16
NFC: Use map_or_else converting Option to Cow
diff --git a/core/src/options/input_variant.rs b/core/src/options/input_variant.rs index 9c6d1ec..6f3cad3 100644 --- a/core/src/options/input_variant.rs +++ b/core/src/options/input_variant.rs @@ -25,8 +25,7 @@ impl InputVariant { name_in_attr: self .attr_name .as_ref() - ...
1
1
2
0aa8d17b00a8f1e4cc5dce58bffe41a2a2d6a018
Ted Driggs
2019-02-12T01:20:25
Remove unnecessary clone of fields when processing variants
diff --git a/core/src/options/input_variant.rs b/core/src/options/input_variant.rs index 2009d46..9c6d1ec 100644 --- a/core/src/options/input_variant.rs +++ b/core/src/options/input_variant.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use syn; -use ast::{Fields, Style}; +use ast::Fields; use codegen; use options::{C...
1
5
11
1426dda03c6377d64dea92798965948a458c0044
Ted Driggs
2019-02-12T00:53:25
Remove unnecessary slices in shape validation
diff --git a/core/src/options/shape.rs b/core/src/options/shape.rs index 71aae4c..fe9f25f 100644 --- a/core/src/options/shape.rs +++ b/core/src/options/shape.rs @@ -88,13 +88,12 @@ impl ToTokens for Shape { } }; - // FIXME: Remove the &[] - tokens.append_all(&[quote! { + tok...
1
5
8
011da4fd39f3ec6d7c099db807b504b851bcfb73
Ted Driggs
2019-02-12T00:37:32
Fix some uses of bare enum variants Generated code should only refer to things by absolute paths
diff --git a/core/src/codegen/attr_extractor.rs b/core/src/codegen/attr_extractor.rs index 0b61004..8289747 100644 --- a/core/src/codegen/attr_extractor.rs +++ b/core/src/codegen/attr_extractor.rs @@ -37,7 +37,8 @@ pub trait ExtractAttribute { let declarations = self.declarations(); let will_parse_a...
3
9
8
9a33d2dec69da7ad5714e76b81dee933d2ca5afd
Ted Driggs
2019-02-08T22:06:31
Generate working code when there are no fields in a meta item The generics in Error::unknown_field_with_alts can't infer a type when given an empty slice literal.
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index 265ac3a..8ea42bd 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -178,7 +178,7 @@ impl<T> Fields<T> { /// Returns true if this variant's data makes it a newtype. pub fn is_newtype(&self) -> bool { - self.style == Style::Tu...
2
21
3
fd2a4f7c33ca668f8cf4e515cabfa435af51cb3d
Ted Driggs
2019-02-08T21:09:26
Break darling_core::error into multiple files
diff --git a/core/src/error/kind.rs b/core/src/error/kind.rs new file mode 100644 index 0000000..183443b --- /dev/null +++ b/core/src/error/kind.rs @@ -0,0 +1,198 @@ +use std::fmt; + +use error::Error; + +type DeriveInputShape = String; +type FieldName = String; +type MetaFormat = String; + +#[derive(Debug)] +// Don't ...
3
213
196
48bd06d4f2a66125d02f6c24d435d2ed63e1fa2f
Ted Driggs
2019-02-08T00:44:31
Add suggestions behind feature flag Fixes #59
diff --git a/Cargo.toml b/Cargo.toml index c36e85d..0adf232 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ syn = "0.15.26" [features] diagnostics = [ "darling_core/diagnostics" ] +suggestions = [ "darling_core/suggestions" ] [workspace] members = ["macro", "core"] diff --git a/core/Cargo.toml b/core...
7
165
7
a4600c65c89ab53312cfc370390ac933bab36c4a
Ted Driggs
2019-02-08T17:46:59
Use parse_quote for tests Dramatically improves test readability
diff --git a/core/src/usage/lifetimes.rs b/core/src/usage/lifetimes.rs index 0bfa9e0..7e2a57b 100644 --- a/core/src/usage/lifetimes.rs +++ b/core/src/usage/lifetimes.rs @@ -287,13 +287,14 @@ mod tests { use usage::GenericsExt; use usage::Purpose::*; - fn parse(src: &str) -> DeriveInput { - syn::pa...
14
151
173
be460f681a9160acf17d4b8b8ac7af089a5f3085
Ted Driggs
2019-02-06T22:53:51
Rename darling_core::derive_fns as it is part of the public API
diff --git a/core/src/derive_fns.rs b/core/src/derive.rs similarity index 100% rename from core/src/derive_fns.rs rename to core/src/derive.rs diff --git a/core/src/lib.rs b/core/src/lib.rs index 7e1c587..4274a64 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -18,7 +18,7 @@ mod macros_public; pub mod ast; pu...
3
7
7
e81906ca84a0244c5d6796221efabb1ebc8e800b
Ted Driggs
2019-02-06T22:52:42
Make darling_core's derive_fns more concise
diff --git a/core/src/derive_fns.rs b/core/src/derive_fns.rs index 9a34f59..92dce8e 100644 --- a/core/src/derive_fns.rs +++ b/core/src/derive_fns.rs @@ -3,19 +3,17 @@ use proc_macro2::TokenStream; use quote::ToTokens; -use syn::{DeriveInput}; +use syn::DeriveInput; -use ::{options, codegen}; +use options; -/// ...
6
74
36
1c3f7a9f29ed7efa515f06f155c9644d7d406b15
Ted Driggs
2019-02-06T21:18:17
Move option parsing and codegen from darling_macro to darling_core This will make reducing the API surface of darling_core easier in future. Fixes #57
diff --git a/core/src/derive_fns.rs b/core/src/derive_fns.rs new file mode 100644 index 0000000..9a34f59 --- /dev/null +++ b/core/src/derive_fns.rs @@ -0,0 +1,61 @@ +//! Functions to derive `darling`'s traits from well-formed input, without directly depending +//! on `proc_macro`. + +use proc_macro2::TokenStream; +use ...
3
71
50
65b1d426d5d5156d2daca525734df9992e26aa07
Ted Driggs
2019-02-06T17:40:30
Remove unnecessary cloning * Use Cow for passing optional-or-defaulted values * Avoid unnecessary into_iter on cloned Vec * Defer list cloning to after removal of punctuation
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index 65eaf8e..265ac3a 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -107,11 +107,7 @@ impl<V: FromVariant, F: FromField> Data<V, F> { syn::Data::Enum(ref data) => { let mut items = Vec::with_capacity(data.variants....
6
31
26
890e6a85e16fc5fd1306ae0e43597ea15a6b96cd
Ted Driggs
2019-02-06T01:14:43
Delay errors in shape validation
diff --git a/core/src/options/shape.rs b/core/src/options/shape.rs index df56555..71aae4c 100644 --- a/core/src/options/shape.rs +++ b/core/src/options/shape.rs @@ -40,14 +40,18 @@ impl FromMeta for Shape { if word == "any" { new.any = true; } else if word.starts_w...
1
24
8
6d5458530f7f125aa3c419c5bc2f6fff4d8854c1
Ted Driggs
2019-02-05T18:27:32
Use late returns in darling_core's own attribute parsing This improves ergonomics for darling's direct users. We won't catch the duplicate-field case if one of the early ones is in error state. Fixes #11
diff --git a/core/src/options/input_field.rs b/core/src/options/input_field.rs index 4ba4891..6dce974 100644 --- a/core/src/options/input_field.rs +++ b/core/src/options/input_field.rs @@ -137,7 +137,7 @@ impl ParseAttribute for InputField { self.multiple = FromMeta::from_meta(mi)?; Ok...
3
48
25
4512e315e2c1168c4ee67633de2e0779bfa920f5
Ted Driggs
2019-02-04T20:21:22
Account for missing ergonomics in rust 1.18.0
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index 0f437c9..ee80f1b 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -221,7 +221,7 @@ impl FromMeta for syn::Ident { } fn from_value(value: &Lit) -> Result<Self> { - if let Lit::Str(ref ident) = value { + if let Lit...
1
2
2
3eb1ec8c18a138d4aa62da5ece81612b0cfe6a87
Ted Driggs
2019-02-04T19:15:08
Preserve paths when parsing idents and paths from meta items
diff --git a/core/src/error.rs b/core/src/error.rs index d8ede5c..311adaf 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -7,7 +7,7 @@ use std::iter::{self, Iterator}; use std::string::ToString; use std::vec; use syn::spanned::Spanned; -use syn::Lit; +use syn::{Lit, LitStr}; /// An alias of `Result` spe...
2
34
7
97521857a1bca79eac0c55e0faf3172919495386
Ted Driggs
2019-02-04T19:04:32
Set span in Error::unknown_lit_type Improves ergonomics of the error constructor
diff --git a/core/src/error.rs b/core/src/error.rs index 48d1daa..d8ede5c 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -71,7 +71,34 @@ impl Error { } /// Creates a new error for a field which has an unexpected literal type. This will automatically - /// extract the literal type name from the...
1
29
2
2373ca95006886ed6de8c66e5eea3c4d2ea849aa
Ted Driggs
2019-02-04T18:18:16
Improve error messages for unknown literal types. (#53) Literals that aren't contextually accepted will now state their exact type, rather than "other". This also allows for easier implementations of `FromMeta::from_value`
diff --git a/core/src/error.rs b/core/src/error.rs index b3b965a..48d1daa 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -7,6 +7,7 @@ use std::iter::{self, Iterator}; use std::string::ToString; use std::vec; use syn::spanned::Spanned; +use syn::Lit; /// An alias of `Result` specific to attribute parsin...
2
17
1
e29dd307998bc3a74d57eda304c7022fea6f134d
Ted Driggs
2019-01-29T02:16:20
Fix util::SpannedValue on 1.18.0
diff --git a/core/src/util/spanned_value.rs b/core/src/util/spanned_value.rs index debd3fe..1ea3dfc 100644 --- a/core/src/util/spanned_value.rs +++ b/core/src/util/spanned_value.rs @@ -1,5 +1,6 @@ use proc_macro2::Span; use std::ops::{Deref, DerefMut}; +use syn; use syn::spanned::Spanned; use { FromDeriveInput...
1
1
0
2f7b981d55571fc4a3fceb668e286d3c2ce4147a
Ted Driggs
2019-01-24T17:30:05
Make SpannedValue::span return Span, not &Span The Span derives Copy, so it doesn't make sense to return a reference
diff --git a/core/src/util/spanned_value.rs b/core/src/util/spanned_value.rs index 77f5dc3..debd3fe 100644 --- a/core/src/util/spanned_value.rs +++ b/core/src/util/spanned_value.rs @@ -29,9 +29,9 @@ impl<T> SpannedValue<T> { SpannedValue { value, span } } - /// Get a reference to the source code loca...
1
3
3
d982c12558fa8f212a1d4fc4fa5063bcf3618acf
Ted Driggs
2019-01-23T18:42:51
Use new error implementation in darling-macro
diff --git a/macro/src/lib.rs b/macro/src/lib.rs index 0553ef9..1bba77b 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -10,11 +10,22 @@ use proc_macro::TokenStream; use darling_core::{codegen, options}; +macro_rules! check_errors { + ($e:expr) => { + match $e { + Ok(val) => val, + ...
1
16
6
d4ba41525e2eb43b66929e229c4361ec555712de
Ted Driggs
2019-01-23T18:05:10
Make SpannedValue support all darling traits
diff --git a/core/src/util/spanned_value.rs b/core/src/util/spanned_value.rs index dbdceed..77f5dc3 100644 --- a/core/src/util/spanned_value.rs +++ b/core/src/util/spanned_value.rs @@ -1,8 +1,10 @@ -use ::{FromMeta, Result}; use proc_macro2::Span; use std::ops::{Deref, DerefMut}; use syn::spanned::Spanned; -use syn:...
1
23
9
f4b3e7488e56e65e9c2f8daa00a3ee46c8ac7a45
Ted Driggs
2019-01-22T16:31:59
Address some clippy lints (#48) Address some clippy lints about performance and idiomatic trait use. This commit doesn't change items that may have Rust version dependencies, so clippy still reports some issues on 1.32.0 after this commit.
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index 8c644e9..65eaf8e 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -16,7 +16,7 @@ pub enum Data<V, F> { Struct(Fields<F>), } -#[deprecated(since = "0.3", note = "this has been renamed to Data")] +#[deprecated(since = "0.3.0", note = "t...
13
63
72
66cde1e1b33ceed2f77d8f825d6d5d7b018f5673
Ted Driggs
2019-01-21T22:08:24
Add tests to util::IdentList
diff --git a/core/src/util/ident_list.rs b/core/src/util/ident_list.rs index d81697c..4da04a9 100644 --- a/core/src/util/ident_list.rs +++ b/core/src/util/ident_list.rs @@ -52,10 +52,50 @@ impl FromMeta for IdentList { if let NestedMeta::Meta(Meta::Word(ref ident)) = *nmi { idents.push(ide...
1
41
1
e0347f70175f541553bbc199bd4d9f98813a3919
Ted Driggs
2019-01-21T19:46:23
Clean up docs and formatting for `Error`
diff --git a/core/src/error.rs b/core/src/error.rs index ad9f445..4ec5af8 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -1,12 +1,12 @@ //! Types for working with darling errors and results. use proc_macro2::Span; -use syn::spanned::Spanned; use std::error::Error as StdError; use std::fmt; use std::it...
1
24
9
e52bb7565e4eead47f783c9fd78618a95a83ad9d
Ted Driggs
2019-01-21T19:27:23
Add unit test for HashMap parse failure case
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index 1541927..d8628be 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -47,6 +47,12 @@ pub trait FromMeta: Sized { /// Create an instance from a `syn::Meta` by dispatching to the format-appropriate /// trait function. This generall...
1
34
3
57c4ef486c5294380411dcf8b51c2067b6e98ffe
Ted Driggs
2019-01-18T03:29:14
Add back a #[macro_use] for 1.18
diff --git a/examples/fallible_read.rs b/examples/fallible_read.rs index 4f74380..c487854 100644 --- a/examples/fallible_read.rs +++ b/examples/fallible_read.rs @@ -4,7 +4,7 @@ //! 1. Using `darling::Result` as a carrier to preserve the error for later display //! 1. Using `Result<T, syn::Meta>` to attempt a recovery...
1
1
1
fd7d137c0579bf7d03230713a208112d8ccc0085
Ted Driggs
2019-01-18T03:23:17
Remove an erroneous println!
diff --git a/core/src/util/spanned_value.rs b/core/src/util/spanned_value.rs index 6f62298..dbdceed 100644 --- a/core/src/util/spanned_value.rs +++ b/core/src/util/spanned_value.rs @@ -61,7 +61,6 @@ impl<T> AsRef<T> for SpannedValue<T> { impl<T: FromMeta> FromMeta for SpannedValue<T> { fn from_meta(item: &Meta)...
1
0
1
b3fd5f77c7b2788adb37adc18ed06fbb11a59f3d
Ted Driggs
2019-01-18T03:20:35
Don't use syntax that 1.18 can't understand The previous two commits fixed #49
diff --git a/core/src/util/spanned_value.rs b/core/src/util/spanned_value.rs index bdd7ed4..6f62298 100644 --- a/core/src/util/spanned_value.rs +++ b/core/src/util/spanned_value.rs @@ -1,4 +1,4 @@ -use crate::{FromMeta, Result}; +use ::{FromMeta, Result}; use proc_macro2::Span; use std::ops::{Deref, DerefMut}; use s...
1
1
1
a8ff261d68fb6a37f93ebf55b0ef9ba46082d489
Ted Driggs
2019-01-15T19:03:20
Add spans to darling Errors This change introduces a new field to errors for storing spans. This will be used to put errors on the correct source positions when diagnostics are stable.
diff --git a/core/src/error.rs b/core/src/error.rs index 73bda73..00145de 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -1,5 +1,7 @@ //! Types for working with darling errors and results. +use proc_macro2::Span; +use syn::spanned::Spanned; use std::error::Error as StdError; use std::fmt; use std::iter...
2
60
12
06e23d4c3a0f242fc9d1f517388ed9cbb2a790e8
Ted Driggs
2019-01-08T16:50:24
Minor internal API cleanup
diff --git a/core/src/ast/data.rs b/core/src/ast/data.rs index 1c2cd79..8c644e9 100644 --- a/core/src/ast/data.rs +++ b/core/src/ast/data.rs @@ -1,4 +1,4 @@ -use std::slice; +use std::{slice, vec}; use syn; @@ -156,6 +156,7 @@ impl<V: UsesLifetimes, F: UsesLifetimes> UsesLifetimes for Data<V, F> { } } +///...
2
13
4
6c61fff54bdd5267ba3fb89e8544b3003ea1399c
Ted Driggs
2019-01-08T16:25:48
Format examples
diff --git a/examples/automatic_bounds.rs b/examples/automatic_bounds.rs index 06263f1..0b9aec4 100644 --- a/examples/automatic_bounds.rs +++ b/examples/automatic_bounds.rs @@ -68,7 +68,8 @@ fn main() { Div(String) } "#, - ).unwrap(); + ) + .unwrap(); let parsed: SpeakingOptio...
4
7
7
c1853797cfc66625a277dd0cb40b70a162f9075b
Ted Driggs
2018-12-12T17:17:51
Keep version numbers of all packages in sync
diff --git a/Cargo.toml b/Cargo.toml index 3adfef2..9d1de95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "darling" version = "0.8.1" authors = ["Ted Driggs <ted.driggs@outlook.com>"] repository = "https://github.com/TedDriggs/darling" -documentation = "https://docs.rs/darling/0.8.0" +documentation...
3
6
6
c1778ee11eb3563b1f78220a5655b597d84ddbfd
Bastien Orivel
2018-12-12T17:14:58
Fix some performance related clippy warnings and bump version (#45)
diff --git a/Cargo.toml b/Cargo.toml index 180cb2d..3adfef2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "darling" -version = "0.8.0" +version = "0.8.1" authors = ["Ted Driggs <ted.driggs@outlook.com>"] repository = "https://github.com/TedDriggs/darling" documentation = "https://docs.r...
4
6
6
c77984cd6395e5e8b9c5115255700482ec8b1f72
hcpl
2018-10-02T00:11:04
Update syn dependency to 0.15 (#44) * Update syn dependency to 0.15 * Use `parse_macro_input` macro for parsing inputs It will generate better compiler error messages than `syn::parse(input).unwrap()`. * Fix crate docs The field name that is used to pass the input body is actually `data`, not `body`.
diff --git a/Cargo.toml b/Cargo.toml index 499bf17..bfb625e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ darling_macro = { version = "=0.7.0", path = "macro" } [dev-dependencies] proc-macro2 = "0.4" quote = "0.6" -syn = "0.14" +syn = "0.15" [workspace] members = ["macro", "core"] diff --git a/core/...
8
16
14
30dc1642077d75841205fb13ca9ba8d7c761caed
Ted Driggs
2018-05-23T21:55:36
Never panic in FromMeta for syn types
diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index d818f1c..bcb8334 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -120,13 +120,13 @@ impl FromMeta for bool { } fn from_string(value: &str) -> Result<Self> { - value.parse().or_else(|_| Err(Error::unknown_value(value)))...
1
21
24
900c1c11b999153c5242929d9f787f0133bee6ac
Ted Driggs
2018-05-22T20:35:00
Add usage support for WherePredicate
diff --git a/core/src/usage/lifetimes.rs b/core/src/usage/lifetimes.rs index 5f527a9..80aee6f 100644 --- a/core/src/usage/lifetimes.rs +++ b/core/src/usage/lifetimes.rs @@ -107,6 +107,9 @@ uses_lifetimes!(syn::LifetimeDef, lifetime, bounds); uses_lifetimes!(syn::ParenthesizedGenericArguments, inputs, output); uses_li...
2
29
0
df87133af76a898734a29ec2ce95663833b0e188
Ted Driggs
2018-05-22T19:28:09
Bump version to 0.6.2
diff --git a/Cargo.toml b/Cargo.toml index defc04e..791ff4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "darling" -version = "0.6.1" +version = "0.6.2" authors = ["Ted Driggs <ted.driggs@outlook.com>"] repository = "https://github.com/TedDriggs/darling" -documentation = "https://docs.r...
3
7
7
0f2ee8ce5eea08fda13e85cc59f664f9c7204c3c
Ted Driggs
2018-05-22T16:27:01
Use macro for DataEnum type params
diff --git a/core/src/usage/type_params.rs b/core/src/usage/type_params.rs index 03283d0..d804f4a 100644 --- a/core/src/usage/type_params.rs +++ b/core/src/usage/type_params.rs @@ -71,6 +71,7 @@ impl<T: UsesTypeParams, U> UsesTypeParams for Punctuated<T, U> { uses_type_params!(syn::AngleBracketedGenericArguments, args...
1
1
6
cea3b57d51ef8fecc25de251737394d0bf7e1e81
Xidorn Quan
2018-05-16T15:06:09
Remove unnecessary Option in codegen::{FromDeriveInputImpl, FromVariantImpl} `From{Derive,Variant}` only have one place each initializes them, and both places use `Some` on `from_ident`, so it seems unnecessary to use `Option<bool>` on them.
diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs index bd29308..d8a299d 100644 --- a/core/src/codegen/from_derive_impl.rs +++ b/core/src/codegen/from_derive_impl.rs @@ -14,7 +14,7 @@ pub struct FromDeriveInputImpl<'a> { pub base: TraitImpl<'a>, pub attr_names: Vec<&'a s...
4
6
6
90135792dd812fa2a55daa8372cd7b9be4119745
Xidorn Quan
2018-05-03T00:24:50
Implement FromTypeParam (#30) * Implement FromTypeParam. This fixes #28.
diff --git a/core/src/codegen/from_type_param.rs b/core/src/codegen/from_type_param.rs new file mode 100644 index 0000000..e97dc49 --- /dev/null +++ b/core/src/codegen/from_type_param.rs @@ -0,0 +1,97 @@ +use quote::{Tokens, ToTokens}; +use syn::{self, Ident}; + +use codegen::{ExtractAttribute, OuterFromImpl, TraitImpl...
10
299
1
4e22aafae637fb128eab120a75c021876e4a176b
hcpl
2018-04-01T22:07:49
Update dependencies
diff --git a/Cargo.toml b/Cargo.toml index 07e7eb0..ce129a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,8 @@ darling_core = { version = "=0.3.2", path = "core" } darling_macro = { version = "=0.3.2", path = "macro" } [dev-dependencies] -syn = "0.12.10" -quote = "0.4" +quote = "0.5" +syn = "0.13" [works...
4
8
7
3c00f2dbb77eb9c89ea5ebb60c2014227c245de5
Ted Driggs
2018-03-13T18:17:07
Bump version to 0.3.2
diff --git a/Cargo.toml b/Cargo.toml index c8bff6a..07e7eb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "darling" -version = "0.3.1" +version = "0.3.2" authors = ["Ted Driggs <ted.driggs@outlook.com>"] repository = "https://github.com/TedDriggs/darling" -documentation = "https://docs.r...
3
7
7
5151b8a30a5ddb578ad20ab52aeb4d0c4f2682e7
강동윤
2018-03-04T04:45:28
Support proc-macro2/nightly Fixes #23.
diff --git a/core/Cargo.toml b/core/Cargo.toml index 0ad7512..673f48e 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -17,4 +17,5 @@ default = ["syn/full"] [dependencies] ident_case = "1.0.0" syn = { version = "0.12.10", features = ["extra-traits"] } +proc-macro2 = "0.2" quote = "0.4" diff --git a/core/src/co...
6
12
4
5c12d5bc3580b23f8db37ab2d587dd0d33e1e8b3
Ted Driggs
2018-01-26T20:49:58
Fix tests in darling_core Changes in the shape of syn::Attribute broke the unit tests for shape options and FromMetaItem impls for simple types
diff --git a/core/src/from_meta_item.rs b/core/src/from_meta_item.rs index c776b40..d808a18 100644 --- a/core/src/from_meta_item.rs +++ b/core/src/from_meta_item.rs @@ -303,58 +303,60 @@ impl<V: FromMetaItem> FromMetaItem for HashMap<String, V> { #[cfg(test)] mod tests { use syn; + use quote::Tokens; u...
2
31
27
b714e27f39be8e4c233723e044a79ac87272c12c
Bastien Orivel
2018-01-25T17:02:31
Add deprecated type aliases both for both Body and VariantData This will hopefully make migrating from 0.2 to 0.3 easier.
diff --git a/core/src/ast.rs b/core/src/ast.rs index d01555a..a0b68fa 100644 --- a/core/src/ast.rs +++ b/core/src/ast.rs @@ -13,6 +13,9 @@ pub enum Data<V, F> { Struct(Fields<F>), } +#[deprecated(since="0.3", note="this has been renamed to Data")] +pub type Body<V, F> = Data<V, F>; + impl<V, F> Data<V, F> { ...
1
6
0
5096dc5ca11561248b908694106c23469d05b01f
Bastien Orivel
2018-01-25T13:41:42
Rename VariantData to Fields to match syn's way of naming that
diff --git a/core/src/ast.rs b/core/src/ast.rs index 0241797..d01555a 100644 --- a/core/src/ast.rs +++ b/core/src/ast.rs @@ -10,7 +10,7 @@ use {Error, FromField, FromVariant, Result}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum Data<V, F> { Enum(Vec<V>), - Struct(VariantData<F>), + Struct(Fields<F>), ...
12
54
54
2f4d08e4537edd4d60de34249c32bcfcf160d2f0
Bastien Orivel
2018-01-25T13:40:48
Rename Body to Data to match syn's way of naming that
diff --git a/core/src/ast.rs b/core/src/ast.rs index 50fde79..0241797 100644 --- a/core/src/ast.rs +++ b/core/src/ast.rs @@ -8,90 +8,90 @@ use {Error, FromField, FromVariant, Result}; /// /// `V` is the type which receives any encountered variants, and `F` receives struct fields. #[derive(Debug, Clone, PartialEq, Eq...
14
72
72
3787d08c8ce5dd00cab2ff762d70ef50a933f9e3
Ted Driggs
2017-12-07T04:16:58
Improve and expand examples
diff --git a/examples/consume_fields.rs b/examples/consume_fields.rs index dac8ce6..b2b280c 100644 --- a/examples/consume_fields.rs +++ b/examples/consume_fields.rs @@ -1,3 +1,5 @@ +//! This example shows how to do struct and field parsing using darling. + #[macro_use] extern crate darling; @@ -6,7 +8,9 @@ extern c...
2
107
7
e0421f0126340d590f1121b962610915972300aa
Ted Driggs
2017-12-05T20:01:53
Handle tuple structs in consume_fields example
diff --git a/examples/consume_fields.rs b/examples/consume_fields.rs index d56b354..dac8ce6 100644 --- a/examples/consume_fields.rs +++ b/examples/consume_fields.rs @@ -74,17 +74,20 @@ impl ToTokens for MyInputReceiver { // Generate the actual values to fill the format string. let field_list = fields ...
1
9
6
84c0b3799b63596a4113e962141b8f897b87d87b
Ted Driggs
2017-12-05T19:05:59
Add a more involved example. See #17 for more details
diff --git a/Cargo.toml b/Cargo.toml index a56db02..94aecbc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ darling_macro = { version = "=0.2.2", path = "macro" } [dev-dependencies] syn = "0.11.11" +quote = "0.3.15" [workspace] members = ["macro", "core"] diff --git a/examples/consume_fields.rs b/exa...
2
133
0
611e58b7e79e69e78bf1c2cd94673c4b501b86ca
Ted Driggs
2017-06-19T03:40:02
Bump to v0.2.0 for release
diff --git a/Cargo.toml b/Cargo.toml index 6c0954f..42086ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "darling" -version = "0.1.6" +version = "0.2.0" authors = ["Ted Driggs <ted.driggs@outlook.com>"] repository = "https://github.com/TedDriggs/darling" -documentation = "https://docs.r...
3
8
8
df75d6e6893ef1d8a7f90bfdccc81f5d794937af
Ted Driggs
2017-06-19T03:20:14
Remove default types for type params on ast::Body
diff --git a/core/src/ast.rs b/core/src/ast.rs index d8b0d26..4f25bed 100644 --- a/core/src/ast.rs +++ b/core/src/ast.rs @@ -8,7 +8,7 @@ use {Error, FromField, FromVariant, Result}; /// /// `V` is the type which receives any encountered variants, and `F` receives struct fields. #[derive(Debug, Clone, PartialEq, Eq)]...
1
1
1
c1f94c4144b76e3b26427273bc12b67f6e98d186
Ted Driggs
2017-06-19T03:14:20
Multiple fixes related to error-handling Fix #10: Variants now push idents into location path Fix #8: Check for presence of all required fields in enum variants Fix #6: darling now knows when a field was seen and failed validation
diff --git a/core/src/codegen/error.rs b/core/src/codegen/error.rs index b5d222d..ff6a447 100644 --- a/core/src/codegen/error.rs +++ b/core/src/codegen/error.rs @@ -22,23 +22,38 @@ impl ToTokens for ErrorDeclaration { } /// Returns early if attribute or body parsing has caused any errors. -pub struct ErrorCheck { +...
5
152
13
b0e3e70ef7171c904a2ae1eb3fef0ea7df9d9374
Ted Driggs
2017-06-19T01:56:04
Body parsing will continue until all errors have been found
diff --git a/core/src/ast.rs b/core/src/ast.rs index 4c53ee7..d8b0d26 100644 --- a/core/src/ast.rs +++ b/core/src/ast.rs @@ -2,7 +2,7 @@ use syn; -use {FromField, FromVariant, Result}; +use {Error, FromField, FromVariant, Result}; /// A struct or enum body. /// @@ -95,9 +95,20 @@ impl<V: FromVariant, F: FromF...
1
39
11
a11f89d57c38dc6522f660f02f8dc1294fd18db1
Ted Driggs
2017-06-19T01:42:48
Fix #1 with late-returning error collection
diff --git a/core/src/codegen/error.rs b/core/src/codegen/error.rs new file mode 100644 index 0000000..b5d222d --- /dev/null +++ b/core/src/codegen/error.rs @@ -0,0 +1,45 @@ +use quote::{Tokens, ToTokens}; + +/// Declares the local variable into which errors will be accumulated. +pub struct ErrorDeclaration { + __hi...
12
193
29
bed3835d636f837bb7c1c0a102ed909be8f7944d
Ted Driggs
2017-06-19T01:41:23
Resume writing detailed error messages
diff --git a/core/src/error.rs b/core/src/error.rs index 550f3e9..b94b529 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -152,7 +152,7 @@ impl StdError for Error { impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.description())?; + ...
1
1
1