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 |
|---|---|---|---|---|---|---|---|
62e79934f77e6e029149f0305055d7566b22a65a | Jelte Fennema | 2019-11-10T15:06:35 | Add 1.36 as minimum rust version to docs | diff --git a/src/lib.rs b/src/lib.rs
index c62eac3..57d5805 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -119,7 +119,7 @@
//!
//! ## Installation
//!
-//! This library requires Rust 1.32 or higher and it supports `no_std` out of the box.
+//! This library requires Rust 1.36 or higher and it supports `no_std` out of t... | 1 | 1 | 1 |
d4cee3fe981a77e16d9d25f4a9daa4ae8fc36caa | Jelte Fennema | 2019-11-08T08:40:11 | Allow ignore on fields of try_into | diff --git a/src/into.rs b/src/into.rs
index 64b1216..5b4c41b 100644
--- a/src/into.rs
+++ b/src/into.rs
@@ -1,15 +1,21 @@
-use crate::utils::{add_extra_generic_param, MultiFieldData, State};
+use crate::utils::{add_extra_generic_param, MultiFieldData, State, AttrParams};
use proc_macro2::TokenStream;
use quote::{quo... | 5 | 74 | 12 |
9d2eadffa5c0e10cabf34d15b707883774393a88 | Jelte Fennema | 2019-11-07T09:03:26 | Make mul_assign(forward) work with just the mul_assign feature | diff --git a/tests/mul_assign.rs b/tests/mul_assign.rs
index 32dbbe4..e8be781 100644
--- a/tests/mul_assign.rs
+++ b/tests/mul_assign.rs
@@ -10,8 +10,7 @@ struct MyInts(i32, i32);
#[derive(MulAssign)]
#[mul_assign(forward)]
-struct MyInt2(i32);
-
+struct MyIntForward(i32);
#[derive(MulAssign)]
struct Point1D { | 1 | 1 | 2 |
11887db0ab73ddc3e74039143c8863aff091ec96 | Jelte Fennema | 2019-11-07T09:02:51 | Make mul_assign(forward) work with just the mul_assign feature | diff --git a/src/lib.rs b/src/lib.rs
index a751292..c62eac3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -183,9 +183,14 @@ use syn::parse::Error as ParseError;
mod utils;
-#[cfg(feature = "add_assign")]
+#[cfg(any(feature = "add_assign", feature = "mul_assign"))]
mod add_assign_like;
-#[cfg(any(feature = "add", fe... | 2 | 12 | 2 |
c272e0f4e8babc35455c22386d69001e38af1684 | Jelte Fennema | 2019-11-07T09:00:02 | Fix test failures | diff --git a/src/lib.rs b/src/lib.rs
index 6c0de4b..a751292 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -143,6 +143,7 @@
//! extern crate core;
//! #[macro_use]
//! extern crate derive_more;
+//! # fn main(){}
//! ```
//!
//! [`cargo-expand`]: https://github.com/dtolnay/cargo-expand
@@ -184,11 +185,7 @@ mod utils... | 1 | 4 | 17 |
b0201fdc8883b843cf672561b17894cf7368d064 | Jelte Fennema | 2019-11-07T08:46:57 | Change feature names to remove _like suffix | diff --git a/Cargo.toml b/Cargo.toml
index e2b5f77..1f43648 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -40,8 +40,8 @@ appveyor = { repository = "JelteF/derive_more" }
[features]
nightly = []
-add_assign_like = []
-add_like = []
+add_assign = []
+add = []
as_mut = []
as_ref = []
constructor = []
@@ -55,16 +55,16... | 2 | 73 | 73 |
96cb0fe4d44971c6243b95aa5f34380fa36bf1f9 | Jelte Fennema | 2019-11-07T08:43:14 | Update docs in preparation of release | diff --git a/src/lib.rs b/src/lib.rs
index 1242dec..149c2aa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -119,24 +119,32 @@
//!
//! ## Installation
//!
-//! This library requires Rust 1.15 or higher, so this needs to be installed.
+//! This library requires Rust 1.32 or higher and it supports `no_std` out of the box.... | 1 | 14 | 6 |
3cbbbaa959dbdfcc42f94085834df6b5e4a246b9 | Jelte Fennema | 2019-11-06T23:25:41 | Add validating of attr parameters
Fixes #104 | diff --git a/src/as_mut.rs b/src/as_mut.rs
index 5cd51e6..544407a 100644
--- a/src/as_mut.rs
+++ b/src/as_mut.rs
@@ -5,7 +5,7 @@ use syn::{parse::Result, DeriveInput, Ident};
pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result<TokenStream> {
let as_mut_type = &Ident::new("__AsMutT", Span::cal... | 14 | 184 | 35 |
88e0d5e5d1d37c725027da848ca5278661bfb9f5 | Jelte Fennema | 2019-11-06T21:42:05 | Make Sum use State | diff --git a/src/sum_like.rs b/src/sum_like.rs
index e32a11b..19c05db 100644
--- a/src/sum_like.rs
+++ b/src/sum_like.rs
@@ -1,24 +1,31 @@
use crate::utils::{
- add_extra_ty_param_bound, add_extra_where_clauses, field_idents, get_field_types,
- named_to_vec, unnamed_to_vec,
+ add_extra_ty_param_bound, add_ext... | 1 | 28 | 49 |
50834046d85014f8e395671b950c105610effb19 | Jelte Fennema | 2019-11-06T08:41:46 | Make Mul and MulAssign use State | diff --git a/src/index.rs b/src/index.rs
index a5a0630..7343ddb 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -17,14 +17,14 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result<TokenStre
field,
field_type,
input_type,
- trait_path,
+ trait_path_with_params... | 6 | 111 | 132 |
7b67061690e637f47093c2c9d2601db076da5856 | Jelte Fennema | 2019-11-04T21:12:51 | Support trailing space in create_derive macro | diff --git a/src/lib.rs b/src/lib.rs
index 5383f84..1242dec 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -251,7 +251,7 @@ impl Output for Result<proc_macro2::TokenStream, ParseError> {
}
macro_rules! create_derive(
- ($feature:literal, $mod_:ident, $trait_:ident, $fn_name: ident $(,$attribute:ident)*) => {
+ (... | 1 | 14 | 14 |
3d91c2ffd9580f59acfc188c3dd2ff9678e4c0eb | Jelte Fennema | 2019-11-04T21:09:19 | Add forward support to MulAssign | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index e08476d..e779fd8 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -7,8 +7,7 @@ use syn::{Data, DeriveInput, Fields, Ident};
pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
let trait_ident = Ident::new(trait... | 4 | 36 | 17 |
513c67b7b36a31ff5bad54b41d3f677bb24d3c24 | Jelte Fennema | 2019-11-04T08:50:09 | Add forward support for Mul and remove MulSelf
Fixes #101 | diff --git a/src/lib.rs b/src/lib.rs
index 73c95e1..778df1c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -176,9 +176,13 @@ mod utils;
#[cfg(feature = "add_assign_like")]
mod add_assign_like;
-#[cfg(any(feature = "add_like", feature = "add_assign_like"))]
+#[cfg(any(
+ feature = "add_like",
+ feature = "add_ass... | 4 | 42 | 25 |
c42d8905184a18bed1044b63b28bd39183db56dc | Jelte Fennema | 2019-11-03T22:37:42 | Fix rustfmt errors | diff --git a/src/lib.rs b/src/lib.rs
index 8bfb9c2..73c95e1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,7 +21,7 @@
//!
//! ```rust
//! extern crate derive_more;
-//! use derive_more::{Add, From, Into, Display};
+//! use derive_more::{Add, Display, From, Into};
//!
//! #[derive(PartialEq, From, Add)]
//! struc... | 1 | 3 | 3 |
15c944776945a57834afaafc6889f52141f98c50 | Jelte Fennema | 2019-11-03T22:33:46 | Update example | diff --git a/src/lib.rs b/src/lib.rs
index c68144c..8bfb9c2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,30 +21,32 @@
//!
//! ```rust
//! extern crate derive_more;
-//! use derive_more::{Add, Constructor, From, Into, Mul};
+//! use derive_more::{Add, From, Into, Display};
//!
-//! #[derive(Debug, Eq, PartialEq, ... | 1 | 13 | 11 |
bb31c42273b8b5e05727600fbe82c43e7b7cafd8 | Jelte Fennema | 2019-11-03T02:29:12 | Use attribe for ref implementations of Into | diff --git a/src/into.rs b/src/into.rs
index 1e0d7c4..d99e739 100644
--- a/src/into.rs
+++ b/src/into.rs
@@ -1,68 +1,52 @@
-use crate::utils::{
- add_extra_generic_param, field_idents, get_field_types, named_to_vec,
- number_idents, unnamed_to_vec, RefType,
-};
+use crate::utils::{add_extra_generic_param, MultiFi... | 6 | 59 | 83 |
ef84e33bb81291cd0c604f8c129d7eeae40314cf | Jelte Fennema | 2019-11-03T01:01:37 | Fix rustfmt errors | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index f4dbdee..e08476d 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -10,8 +10,7 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
#[allow(deprecated)]
let method_name = method_name.trim_right_matches("As... | 3 | 3 | 5 |
5f0c399018024622b4140e8c0d1a3a699ae2c091 | Jelte Fennema | 2019-11-03T00:59:34 | Fix clippy warnings | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index 0a160c8..f4dbdee 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -11,7 +11,7 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
let method_name = method_name.trim_right_matches("Assign");
let method_na... | 6 | 14 | 17 |
c61a5c58a59d6c7eb35078b131e2efd22cf8c976 | Jelte Fennema | 2019-11-02T15:50:11 | Fix links | diff --git a/src/lib.rs b/src/lib.rs
index a27ec7a..b74ef80 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,7 +6,7 @@
//! [](https://raw.githubusercontent.com/JelteF/derive_more/master/LICENSE)
//!
//! Rust has lots of builtin traits that are impleme... | 1 | 1 | 1 |
137e1c7a030286d67e59e26ce255a2e9b3de9d13 | Jelte Fennema | 2019-11-02T15:45:11 | Temporarily use relative paths for docs for easy debugging | diff --git a/src/lib.rs b/src/lib.rs
index f49f496..a27ec7a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -140,28 +140,28 @@
//! [`cargo-expand`]: https://github.com/dtolnay/cargo-expand
//! [`derive-new`]: https://github.com/nrc/derive-new
//!
-//! [`From`]: https://jeltef.github.io/derive_more/derive_more/from.html
... | 1 | 22 | 22 |
2dbea71da9d85cb0dccb288c0b33db0542972cec | Jelte Fennema | 2019-11-02T14:13:22 | Update lib.rs docs with new readme | diff --git a/src/lib.rs b/src/lib.rs
index 538421b..f49f496 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,10 +1,16 @@
//! # `derive_more`
-//! Rust has lots of builtin traits that are implemented for its basic types, such as [`Add`],
-//! [`Not`] or [`From`].
+//!
+//! [,
impl_generics: data.impl_generics.clone(),
ty_generics: data.ty_generics.clone... | 1 | 1 | 1 |
329b404b39a1515a89aed458efeba622584b6598 | Jelte Fennema | 2019-11-02T21:41:33 | fix clippy | diff --git a/src/utils.rs b/src/utils.rs
index ca0e057..8ed2826 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -411,7 +411,7 @@ impl<'input> State<'input> {
field: data.fields[0],
field_type: data.field_types[0],
member: data.members[0].clone(),
- info: data.infos[0].c... | 1 | 1 | 1 |
b29f01f23608f4a8732a0f9170d43b44ab4cc5e3 | Jelte Fennema | 2019-11-02T21:27:06 | Fix warnings | diff --git a/src/from.rs b/src/from.rs
index 66b258b..8bfbc4e 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -23,9 +23,7 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result<TokenStre
pub fn struct_from(input: &DeriveInput, state: &State) -> TokenStream {
let multi_field_data = state.enabled_f... | 1 | 0 | 2 |
6f7d7e006d75b118108a18a65e64d1944bc30fe5 | Jelte Fennema | 2019-11-02T21:16:22 | Move initializer creation to utils | diff --git a/src/from.rs b/src/from.rs
index 8022cdf..66b258b 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -21,6 +21,7 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result<TokenStre
}
pub fn struct_from(input: &DeriveInput, state: &State) -> TokenStream {
+ let multi_field_data = state.enab... | 4 | 58 | 59 |
f4c1bdaa0d011f7746f95b658589d4a3261f2e67 | Jelte Fennema | 2019-11-02T20:35:44 | Use State for TryInto | diff --git a/src/lib.rs b/src/lib.rs
index ec9c3d4..7a53754 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -426,9 +426,9 @@ create_derive!(
);
create_derive!("iterator", iterator, Iterator, iterator_derive, iterator);
-create_derive!("try_into", try_into, TryInto, try_into_derive);
-create_derive!("try_into", try_into... | 4 | 56 | 50 |
b0355e0a62dcfb75b1677096d5b5e783cb10eab9 | Jelte Fennema | 2019-11-02T18:43:31 | Use State for FromStr as well | diff --git a/src/from_str.rs b/src/from_str.rs
index b08eedb..bbdb5d2 100644
--- a/src/from_str.rs
+++ b/src/from_str.rs
@@ -1,36 +1,51 @@
-use crate::utils::{add_extra_ty_param_bound, named_to_vec, unnamed_to_vec};
+use crate::utils::{DeriveType, SingleFieldData, State};
use proc_macro2::TokenStream;
use quote::quot... | 2 | 41 | 56 |
8f3a3f87fe0395b365a22d6198bde9ca2d586fd0 | Jelte Fennema | 2019-10-27T22:33:27 | Add tests to crate | diff --git a/Cargo.toml b/Cargo.toml
index 95c8ab7..dafc682 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,7 @@ include = [
"LICENSE",
"README.md",
"CHANGELOG.md",
+ "test/**/*.rs", # debian packaging wants this
]
autotests = true | 1 | 1 | 0 |
f13d4cf6c33545443e08bad1bee7b84648454474 | Roman Titov | 2019-10-26T19:54:26 | WIP: Improve derive-Display trait bounds inference (#93) (#95)
First half of #93.
Modified `Display` macro, so that for each field of the following types _or of reference to
such types_ a where clause is generated bounding field's type by `Display` trait:
* `T`
* `T::AssociatedType` and `<T as Trait>::Associa... | diff --git a/src/display.rs b/src/display.rs
index c7e99b9..809973c 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -1,6 +1,7 @@
use std::{
collections::{HashMap, HashSet},
fmt::Display,
+ ops::Deref,
};
use crate::utils::add_extra_where_clauses;
@@ -9,7 +10,7 @@ use quote::{quote, quote_spanned};... | 2 | 204 | 38 |
b0745e798ef3311ced452c56534aab4364d41ab2 | Jelte Fennema | 2019-10-12T15:38:08 | Add forward support for From | diff --git a/src/from.rs b/src/from.rs
index fbbee8b..7b4d3c7 100644
--- a/src/from.rs
+++ b/src/from.rs
@@ -1,10 +1,7 @@
-use crate::utils::{
- field_idents, get_field_types, named_to_vec, number_idents, unnamed_to_vec, DeriveType,
- MultiFieldData, State,
-};
-use proc_macro2::TokenStream;
+use crate::utils::{a... | 3 | 185 | 82 |
f0f556deebfc399abd7d17dded253795d91a7165 | Jelte Fennema | 2019-10-10T08:31:26 | Implement forward attribute for AsRef and AsMut | diff --git a/src/as_mut.rs b/src/as_mut.rs
index fb5ecd1..5cd51e6 100644
--- a/src/as_mut.rs
+++ b/src/as_mut.rs
@@ -1,9 +1,10 @@
-use crate::utils::{MultiFieldData, State};
-use proc_macro2::TokenStream;
+use crate::utils::{add_where_clauses_for_new_ident, MultiFieldData, State};
+use proc_macro2::{Span, TokenStream};... | 9 | 134 | 19 |
1467c043c347c59b361c9f5afd85fbf7a87008a7 | Jelte Fennema | 2019-10-08T20:16:49 | Add generic test | diff --git a/tests/generics.rs b/tests/generics.rs
index 5442da5..305c2b6 100644
--- a/tests/generics.rs
+++ b/tests/generics.rs
@@ -48,6 +48,8 @@ struct WrappedDouble<T: Clone, U: Clone>(T, U);
Constructor,
Sum
)]
+#[deref(forward)]
+#[deref_mut(forward)]
struct Struct<T: Clone> {
t: T,
} | 1 | 2 | 0 |
d010002f6df3416dca76d8f791a88f75ae888655 | Jelte Fennema | 2019-10-08T20:15:56 | Actually use the forward attribute the correct way | diff --git a/src/deref.rs b/src/deref.rs
index 7420c49..1eb3ffe 100644
--- a/src/deref.rs
+++ b/src/deref.rs
@@ -25,12 +25,12 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result<TokenStre
} = state.assert_single_enabled_field();
let (target, body) = if info.forward {
- (quote!(#... | 6 | 30 | 13 |
982fcbf28be9ff80a8a93eae985eb0587576a13e | Jelte Fennema | 2019-10-07T23:33:42 | Repace Deref(Mut)ToInner with #[deref(forward)] attribute | diff --git a/Cargo.toml b/Cargo.toml
index 6b46dcb..95c8ab7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -47,8 +47,6 @@ as_ref = []
constructor = []
deref = []
deref_mut = []
-deref_to_inner = []
-deref_mut_to_inner = []
display = []
from = []
from_str = []
@@ -72,8 +70,6 @@ default = [
"constructor",
"d... | 14 | 165 | 225 |
912e5b704300667d1b8368177128f1679ae31796 | Jelte Fennema | 2019-09-29T11:02:37 | Prepare for forward attribute | diff --git a/src/utils.rs b/src/utils.rs
index b22ae0e..4e1b493 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -254,11 +254,11 @@ impl<'input> State<'input> {
_ => panic_one_field(&trait_name, &trait_attr),
};
- let ignore_attrs: Result<Vec<_>> = fields
+ let meta_infos: Result<Ve... | 1 | 31 | 22 |
96caac81c84b4cb4789ee463794baf9636eb9395 | Jelte Fennema | 2019-09-29T10:30:03 | Use State for AsRef and AsMut | diff --git a/src/as_mut.rs b/src/as_mut.rs
index 51bd5d6..fb5ecd1 100644
--- a/src/as_mut.rs
+++ b/src/as_mut.rs
@@ -1,21 +1,34 @@
-use crate::utils;
+use crate::utils::{MultiFieldData, State};
use proc_macro2::TokenStream;
use quote::quote;
-use syn::DeriveInput;
+use syn::{parse::Result, DeriveInput};
-pub fn exp... | 3 | 87 | 83 |
1179b879678b61d45708aead56329a062aa07d39 | Jelte Fennema | 2019-09-23T22:07:59 | Use new attrs stuff | diff --git a/src/deref.rs b/src/deref.rs
index d7ac834..0831fc0 100644
--- a/src/deref.rs
+++ b/src/deref.rs
@@ -1,35 +1,28 @@
-use crate::utils::{add_extra_ty_param_bound, named_to_vec, unnamed_to_vec};
-use proc_macro2::{Span, TokenStream};
+use crate::utils::{SingleFieldData, State};
+use proc_macro2::TokenStream;
... | 17 | 332 | 392 |
a4f4685b08b37f3ba8b315fae288aed2c8e0ab97 | Jelte Fennema | 2019-09-23T19:48:50 | Move new attr stuff to utils | diff --git a/src/iterator.rs b/src/iterator.rs
index 3f48013..cbb4fc0 100644
--- a/src/iterator.rs
+++ b/src/iterator.rs
@@ -1,16 +1,17 @@
-use crate::utils::{add_extra_ty_param_bound, named_to_vec, unnamed_to_vec};
-use proc_macro2::{Span, TokenStream};
-use quote::{quote, ToTokens};
-use syn::{
- parse::{Error, Re... | 2 | 218 | 213 |
329456b79d527ea3d70b6911c2c6c9d5c8c1a781 | Jelte Fennema | 2019-09-15T20:45:14 | Implement selecting fields by attr for Iterator
fixes #86 | diff --git a/src/iterator.rs b/src/iterator.rs
index f38a3db..3f48013 100644
--- a/src/iterator.rs
+++ b/src/iterator.rs
@@ -1,65 +1,223 @@
use crate::utils::{add_extra_ty_param_bound, named_to_vec, unnamed_to_vec};
use proc_macro2::{Span, TokenStream};
-use quote::quote;
-use syn::{Data, DeriveInput, Field, Fields, ... | 3 | 212 | 39 |
6d1dbe381043a16fbcfa5129fd6609cf924cf37d | Jelte Fennema | 2019-08-22T07:28:49 | Test TryIntoRef(Mut) in no_std test | diff --git a/tests/no_std.rs b/tests/no_std.rs
index c514e1b..a7d4572 100644
--- a/tests/no_std.rs
+++ b/tests/no_std.rs
@@ -54,7 +54,7 @@ struct Wrapped2<T: Clone>(T);
#[derive(From, Not, Add, Mul, AddAssign, Constructor, Sum)]
struct WrappedDouble<T: Clone, U: Clone>(T, U);
-#[derive(Add, Not, TryInto)]
+#[derive... | 1 | 1 | 1 |
a94862944585eba99538185b4f16d0d776e11d80 | Jelte Fennema | 2019-08-21T21:57:56 | Support TryIntoRef and TryIntoRefMut fixes #69 | diff --git a/src/lib.rs b/src/lib.rs
index 0094df0..48eaed8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -418,6 +418,8 @@ create_derive!(
create_derive!("iterator", iterator, Iterator, iterator_derive);
create_derive!("try_into", try_into, TryInto, try_into_derive);
+create_derive!("try_into", try_into, TryIntoRef, ... | 4 | 52 | 17 |
1c7bcf13e2bc3bde90b309b1ddc143f74ed1667c | Jelte Fennema | 2019-08-21T21:34:32 | cargo fmt | diff --git a/src/display.rs b/src/display.rs
index 7772be0..c7e99b9 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -161,10 +161,7 @@ impl<'a, 'b> State<'a, 'b> {
let list = match meta {
Meta::List(list) => list,
_ => {
- return Err(Error::new(
- ... | 3 | 26 | 19 |
1bb2b7a8ca84262be18cab712d2153d5aff7515c | Jelte Fennema | 2019-08-21T21:34:07 | Add extra test to no_std | diff --git a/tests/no_std.rs b/tests/no_std.rs
index 9b06aeb..fe92bc9 100644
--- a/tests/no_std.rs
+++ b/tests/no_std.rs
@@ -43,6 +43,7 @@ struct MyVec<'a>(::core::slice::Iter<'a, i32>);
DerefMutToInner,
IntoIterator,
IntoIteratorRef,
+ IntoIteratorRefMut,
Constructor
)]
struct Wrapped<T: Clone... | 1 | 1 | 0 |
d8acb5eb8117d7dc5ce4a2feafbd46c99ab88bff | Jelte Fennema | 2019-08-21T21:21:28 | Add derives for IntoRef and IntoRefMut fixes #76 | diff --git a/src/into.rs b/src/into.rs
index df622d7..2ab5c2c 100644
--- a/src/into.rs
+++ b/src/into.rs
@@ -1,13 +1,16 @@
-use crate::utils::{field_idents, get_field_types, named_to_vec, number_idents, unnamed_to_vec};
+use crate::utils::{
+ add_extra_generic_param, field_idents, get_field_types, named_to_vec, numb... | 5 | 51 | 14 |
b7af64af7572034b7d1196b86a57aa19b4509078 | Jelte Fennema | 2019-08-20T08:02:50 | Add derives for & and &mut versions of IntoIterator | diff --git a/src/into_iterator.rs b/src/into_iterator.rs
index c01af4f..d7f695b 100644
--- a/src/into_iterator.rs
+++ b/src/into_iterator.rs
@@ -1,10 +1,14 @@
-use crate::utils::{add_extra_ty_param_bound, named_to_vec, unnamed_to_vec};
+use crate::utils::{
+ add_extra_generic_param, add_extra_ty_param_bound_ref, nam... | 7 | 118 | 16 |
ff7600b67b94f18500a8ae16d8bf375ff1027c92 | Jelte Fennema | 2019-08-18T13:23:38 | Fix clippy errors | diff --git a/src/display.rs b/src/display.rs
index d88616c..7772be0 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -239,14 +239,14 @@ impl<'a, 'b> State<'a, 'b> {
))
}
_ => {
- return Err(Error::new(
+ Err(Error::new(
... | 1 | 2 | 2 |
2affda906fec458b1be151ef5a0433a51ae42b05 | Jelte Fennema | 2019-08-18T11:45:14 | Allow deriving Iterator | diff --git a/Cargo.toml b/Cargo.toml
index 706c88a..c4db3a6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,6 +54,7 @@ index = []
index_mut = []
into = []
into_iterator = []
+iterator = []
mul_assign_like = []
mul_like = []
not_like = []
@@ -76,6 +77,7 @@ default = [
"index_mut",
"into",
"into_iter... | 7 | 93 | 3 |
a57098bf8119ea1bcca79f9748225c6ddf1a5d49 | Jelte Fennema | 2019-08-18T11:13:35 | Add newline | diff --git a/tests/generics.rs b/tests/generics.rs
index 34e5da0..5186b9b 100644
--- a/tests/generics.rs
+++ b/tests/generics.rs
@@ -50,6 +50,7 @@ struct Struct<T: Clone> {
struct Struct2<T: Clone> {
t: T,
}
+
#[derive(From, Not, Add, Mul, AddAssign, Constructor, Sum)]
struct DoubleStruct<T: Clone, U: Clone> {... | 1 | 1 | 0 |
fbc6bd311efece95d0d0914bac1d58d1d567e72f | Jelte Fennema | 2019-08-18T11:12:37 | Support deriiving IntoIterator fixes #52 | diff --git a/Cargo.toml b/Cargo.toml
index adb198f..706c88a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -53,6 +53,7 @@ from_str = []
index = []
index_mut = []
into = []
+into_iterator = []
mul_assign_like = []
mul_like = []
not_like = []
@@ -74,6 +75,7 @@ default = [
"index",
"index_mut",
"into",
+... | 7 | 103 | 0 |
88986ecdbc2cbc5aabc569e1a3e8cdf2bd869f1c | Jelte Fennema | 2019-08-18T10:37:12 | Support custom derives of Debug through DebugCustom fixes #68 | diff --git a/src/display.rs b/src/display.rs
index c897410..d88616c 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -14,6 +14,7 @@ use syn::{
/// Provides the hook to expand `#[derive(Display)]` into an implementation of `From`
pub fn expand(input: &DeriveInput, trait_name: &str) -> Result<TokenStream> {
+ l... | 3 | 8 | 0 |
2dac84d699a0500e4daaa6091e18c879deaf030e | Jelte Fennema | 2019-08-18T02:25:03 | Fix no_std after merge | diff --git a/src/display.rs b/src/display.rs
index d6cd40a..c897410 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -69,13 +69,13 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> Result<TokenStream> {
#[allow(unused_variables)]
#[inline]
fn fmt(&self, _derive_more_Di... | 1 | 2 | 2 |
a21118a30685ebe1d75057e9f7c1a1853cd3ef8e | Jelte Fennema | 2019-08-18T02:23:30 | Remove code that's not needed anymore | diff --git a/src/display.rs b/src/display.rs
index 6ec5bbe..d6cd40a 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -103,11 +103,6 @@ struct State<'a, 'b> {
type_params: HashSet<Ident>,
}
-enum Format {
- Fmt(TokenStream),
- Affix(TokenStream),
-}
-
impl<'a, 'b> State<'a, 'b> {
fn get_proper_fmt... | 1 | 15 | 64 |
513a39fd915824f6f0a46ce5e7c10e2fac35bdf7 | Jelte Fennema | 2019-08-18T02:06:04 | Change affix to fmt | diff --git a/src/display.rs b/src/display.rs
index d61ba5c..6ec5bbe 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -167,7 +167,7 @@ impl<'a, 'b> State<'a, 'b> {
Ok(meta)
}
}
- fn get_meta_fmt(&self, meta: &Meta) -> Result<Format> {
+ fn get_meta_fmt(&self, meta: &Meta, outer_enum: ... | 2 | 43 | 7 |
b3601faaa8b9a2b8c3393dfe7273f22c37e9336d | Jelte Fennema | 2019-08-17T23:26:07 | Fix derives that were broken on no_std | diff --git a/src/add_like.rs b/src/add_like.rs
index 8de4f9a..6759d88 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -107,14 +107,14 @@ fn enum_content(input_type: &Ident, data_enum: &DataEnum, method_ident: &Ident)
let matcher = quote! {
(#subtype{#(#field_names: #l_vars),*... | 8 | 37 | 15 |
102758d4fc87eb4bc72671557355c4f54bd908bb | Jelte Fennema | 2019-08-17T23:16:35 | Add basic tests | diff --git a/Cargo.toml b/Cargo.toml
index 060bf0e..adb198f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -101,15 +101,25 @@ name = "constructor"
path = "tests/constructor.rs"
required-features = ["constructor"]
+[[test]]
+name = "deref"
+path = "tests/deref.rs"
+required-features = ["deref"]
+
[[test]]
name = "der... | 4 | 57 | 3 |
e9fc4c45052c4aef983d203f1820486d00381b84 | Jelte Fennema | 2019-08-17T23:09:34 | Rename new Deref behaviour to Deref(Mut)ToInner | diff --git a/Cargo.toml b/Cargo.toml
index 32c28ee..060bf0e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,6 +45,8 @@ add_like = []
constructor = []
deref = []
deref_mut = []
+deref_to_inner = []
+deref_mut_to_inner = []
display = []
from = []
from_str = []
@@ -64,6 +66,8 @@ default = [
"constructor",
... | 7 | 149 | 8 |
3fc53cee765a87d40a28ef10bae25b1b4dd73ee0 | Jelte Fennema | 2019-08-17T22:39:25 | Allow deriving of Mul for Self: derive(MulSelf) | diff --git a/src/add_like.rs b/src/add_like.rs
index 22c629b..8de4f9a 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -8,6 +8,7 @@ use std::iter;
use syn::{Data, DataEnum, DeriveInput, Field, Fields, Ident};
pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
+ let trait_name = trait_name... | 3 | 7 | 8 |
b4027050ad17bdd7b0da7323a3b03280b2c10e04 | Jelte Fennema | 2019-08-17T22:04:15 | Fix clippy | diff --git a/src/sum_like.rs b/src/sum_like.rs
index 995d247..36531e8 100644
--- a/src/sum_like.rs
+++ b/src/sum_like.rs
@@ -25,15 +25,15 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
.type_params()
.map(|t| t.ident.clone())
.collect();
- let generics = if type_p... | 1 | 3 | 3 |
61341932ee101d8658b33934d94004095ac37aef | Jelte Fennema | 2019-08-17T21:33:10 | Implement derives for Sum and Product fixes #65 | diff --git a/Cargo.toml b/Cargo.toml
index c92e4c4..32c28ee 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,6 +54,7 @@ into = []
mul_assign_like = []
mul_like = []
not_like = []
+sum_like = []
try_into = []
generate-parsing-rs = ["peg"]
@@ -72,6 +73,7 @@ default = [
"mul_assign_like",
"mul_like",
... | 8 | 173 | 10 |
44b2f3f05ef26d2a769fdece3fff3b0949b73dcd | Jelte Fennema | 2019-08-17T21:31:50 | Only use core crate for derived generic contstraints | diff --git a/src/utils.rs b/src/utils.rs
index 6d0925e..ab6da99 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -46,7 +46,7 @@ pub fn add_extra_type_param_bound_op_output<'a>(
for type_param in &mut generics.type_params_mut() {
let type_ident = &type_param.ident;
let bound: TypeParamBound =
- ... | 1 | 3 | 3 |
5e39188f18da0416ecebed1583878c12fe8f05a1 | Jelte Fennema | 2019-08-14T07:43:34 | Support no_std by always importing from traits from core | diff --git a/Cargo.toml b/Cargo.toml
index 4747d44..c3056cd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -40,10 +40,4 @@ appveyor = { repository = "JelteF/derive_more" }
[features]
nightly = []
-no_std = []
generate-parsing-rs = ["peg"]
-
-[[test]]
-name = "no_std"
-path = "tests/no_std.rs"
-required-features = ["n... | 13 | 29 | 67 |
70320da4e532de342e78f8954c34fd5cbc14f129 | Jelte Fennema | 2019-08-14T07:22:11 | Use 2018 idioms | diff --git a/src/add_like.rs b/src/add_like.rs
index d897ff8..5da6b33 100644
--- a/src/add_like.rs
+++ b/src/add_like.rs
@@ -1,11 +1,11 @@
-use proc_macro2::{Span, TokenStream};
-use quote::ToTokens;
-use std::iter;
-use syn::{Data, DataEnum, DeriveInput, Field, Fields, Ident, Index};
use crate::utils::{
add_extr... | 15 | 63 | 32 |
72380e20b1ed6eb8ef5b0b4b1bf88217d6d3f4e1 | Jelte Fennema | 2019-08-14T07:21:54 | Use 2018 idioms | diff --git a/src/lib.rs b/src/lib.rs
index 737af59..7e28abf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -190,10 +190,8 @@
#![recursion_limit = "128"]
extern crate proc_macro;
-extern crate proc_macro2;
-#[macro_use]
-extern crate quote;
-extern crate syn;
+use proc_macro2;
+use syn;
use proc_macro::TokenStream;
... | 2 | 6 | 8 |
52be4e87ffad4a4d5dadc1433abd915234d1da45 | Jelte Fennema | 2019-08-14T07:05:37 | Use 2018 edition | diff --git a/Cargo.toml b/Cargo.toml
index 490a827..4747d44 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,6 +6,7 @@ authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT"
repository = "https://github.com/JelteF/derive_more"
documentation = "https://jeltef.github.io/derive_more/derive_more/"
+edition = ... | 16 | 23 | 22 |
534286886a47b56d5aafed8bfb43d8ae04527128 | Bastien Orivel | 2019-08-13T18:04:15 | Update syn related crates to 1.0 (#85) | diff --git a/Cargo.toml b/Cargo.toml
index e5d7dad..f623146 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,10 +26,10 @@ proc-macro = true
[dependencies]
lazy_static = "1.3"
-proc-macro2 = "0.4"
-quote = "0.6"
+proc-macro2 = "1"
+quote = "1"
regex = "1"
-syn = { version = "0.15", features = ["extra-traits"] }
+syn... | 4 | 30 | 24 |
35fcb312cbe80ef00e596215acd38112aa501f94 | Simon Chemouil | 2019-07-19T14:25:49 | Issue #48: derive `Deref` and `DerefMut` directly on any newtype structs's single field instead of requiring inner field to implement the traits.
This is a backwards-incompatible change, though many usages will require no call-site modification. | diff --git a/src/deref.rs b/src/deref.rs
index cc2f544..9a20f2c 100644
--- a/src/deref.rs
+++ b/src/deref.rs
@@ -27,14 +27,13 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
let generics = add_extra_ty_param_bound(&input.generics, trait_path);
let (impl_generics, ty_generics, where_cl... | 3 | 18 | 8 |
d8de4b8063ae6a2ce709ebf08075ba3905b42c2c | Erich Gubler | 2019-06-10T20:26:32 | WIP: Add affixes to enums | diff --git a/src/display.rs b/src/display.rs
index b9266cd..5aaa535 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -72,6 +72,24 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> Result<TokenStream> {
#[allow(unused_variables)]
#[inline]
fn fmt(&self, _derive_more_Dis... | 2 | 207 | 72 |
1f1fc01e8c20f5981a15cd357be83bf0cafe225f | Erich Gubler | 2019-06-10T20:24:24 | Add leading space to braced `quote!` invocations | diff --git a/src/constructor.rs b/src/constructor.rs
index a026bc3..f727588 100644
--- a/src/constructor.rs
+++ b/src/constructor.rs
@@ -21,7 +21,7 @@ pub fn expand(input: &DeriveInput, _: &str) -> TokenStream {
_ => panic!("Only structs can derive a constructor"),
};
let original_types = &get_field_... | 5 | 6 | 6 |
9cd49e48f42e02e5aa76c530ea9e4032ed0942db | Erich Gubler | 2019-06-10T20:26:50 | Run `cargo fmt` | diff --git a/src/display.rs b/src/display.rs
index 52a6249..b9266cd 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -168,20 +168,12 @@ impl<'a, 'b> State<'a, 'b> {
}
fn infer_fmt(&self, fields: &Fields, name: &Ident) -> Result<TokenStream> {
let fields = match fields {
- Fields::Unit =... | 2 | 16 | 11 |
4b2ff033d35d49fc2d8bfc6f256e71796387bdbb | Jelte Fennema | 2019-06-08T15:16:29 | (cargo-release) start next development iteration 0.15.1-pre | diff --git a/Cargo.toml b/Cargo.toml
index b7ac146..e5d7dad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.15.0"
+version = "0.15.1-pre"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
689ce093722bcabbf6143f72331710dabf73a9bf | Kai Ren | 2019-06-08T15:14:17 | Provide type parameter bounds for Display (#78)
* Bootstrap extra where clauses
* Bootstrap parameters detection
* Bootstrap bounds applying
* Impl bounds for unnamed fields
* Refactor to single type params retrieving
* Correct trait detection for fmt argument
* Fill up tests
* Impl bounds for inf... | diff --git a/Cargo.toml b/Cargo.toml
index 80b2934..047acad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,9 +25,11 @@ name = "derive_more"
proc-macro = true
[dependencies]
+lazy_static = "1.3"
+proc-macro2 = "0.4"
quote = "0.6"
-syn = { version = "0.15", features = ['extra-traits'] }
-proc-macro2 = "0.4.19"
+reg... | 4 | 515 | 38 |
1fa1cde77b40985a881adff0b5a8d1536bfeb045 | Jelte Fennema | 2019-06-08T14:43:06 | Fix deprecation warning | diff --git a/src/utils.rs b/src/utils.rs
index 3927f7f..824dd90 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -32,7 +32,9 @@ pub fn field_idents<'a>(fields: &'a [&'a Field]) -> Vec<&'a Ident> {
.collect()
}
-pub fn get_field_types_iter<'a>(fields: &'a [&'a Field]) -> Box<Iterator<Item = &'a Type> + 'a> {
... | 1 | 3 | 1 |
494beafb8515e865a717352942456cb14c7da117 | Jelte Fennema | 2019-05-25T08:46:35 | (cargo-release) start next development iteration 0.14.2-pre | diff --git a/Cargo.toml b/Cargo.toml
index 39cfce9..80b2934 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.14.1"
+version = "0.14.2-pre"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
e0c3905efdc9d6160c2c998a0f48c0b0f541ec5a | Jelte Fennema | 2019-05-25T08:46:16 | (cargo-release) version 0.14.1 | diff --git a/Cargo.toml b/Cargo.toml
index eb4f17f..39cfce9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.14.1-pre"
+version = "0.14.1"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
5585038d2b28c1b7208568a7b4056819739ce247 | Jelte Fennema | 2019-05-24T06:54:53 | Fix clippy warning | diff --git a/src/display.rs b/src/display.rs
index f4f1ebc..4759e46 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -90,7 +90,7 @@ impl<'a, 'b> State<'a, 'b> {
fn find_meta(&self, attrs: &[Attribute]) -> Result<Option<Meta>> {
let mut it = attrs
.iter()
- .filter_map(|a| a.inte... | 1 | 1 | 1 |
8fb3602ca76f806de69f5ac6b337e46358276d0a | Peter Corlett | 2019-03-26T11:58:28 | Fix unhygenic use of `Result` in `TryInto` macro (#73) | diff --git a/src/try_into.rs b/src/try_into.rs
index 8a55dbb..0f49f7a 100644
--- a/src/try_into.rs
+++ b/src/try_into.rs
@@ -77,7 +77,7 @@ fn enum_try_into(input: &DeriveInput, data_enum: &DataEnum) -> TokenStream {
#[allow(unused_variables)]
#[inline]
- fn try_from(va... | 2 | 5 | 1 |
b9c043253eaec708d026817fca03f156658d9ea2 | Ryan Osial | 2019-02-26T07:04:20 | Add inline attribute to Neg and Not traits (#71)
Other traits received the inline attribute but this one was
accidentally missed | diff --git a/src/not_like.rs b/src/not_like.rs
index 64b1712..1a9611e 100644
--- a/src/not_like.rs
+++ b/src/not_like.rs
@@ -37,6 +37,7 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream {
quote!(
impl#impl_generics #import_root::ops::#trait_ident for #input_type#ty_generics #where_cla... | 1 | 1 | 0 |
bd08b5a26f5432caa4017f228d1b929e9cedab1d | Jelte Fennema | 2019-02-02T01:41:00 | (cargo-release) start next development iteration 0.14.1-pre | diff --git a/Cargo.toml b/Cargo.toml
index 842322d..eb4f17f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.14.0"
+version = "0.14.1-pre"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
669d6fc8b37641e541c736c1125d87bc5fb6d340 | Jelte Fennema | 2019-02-02T01:40:35 | (cargo-release) version 0.14.0 | diff --git a/Cargo.toml b/Cargo.toml
index 50dda48..842322d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.13.1-pre"
+version = "0.14.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
768a3f2ba99f8c28de1fd309614f0aec015cf195 | Jelte Fennema | 2019-02-02T00:18:10 | Undo poluting arguments for no_std | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index 405e772..4b2179e 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -3,11 +3,7 @@ use proc_macro2::{Span, TokenStream};
use syn::{Data, DeriveInput, Fields, Ident};
use utils::{add_extra_ty_param_bound_op, named_to_vec, unnamed_to_vec... | 17 | 84 | 184 |
4de09a3f82de79b0ebfc665fae691069ce1c6ac4 | Paul Florence | 2018-11-21T09:00:18 | Added a new argument to expand : `import_root` which represent the root
from which we will import traits.
This allows to choose betwenn std and core for traits implementation. | diff --git a/src/add_assign_like.rs b/src/add_assign_like.rs
index 4b2179e..405e772 100644
--- a/src/add_assign_like.rs
+++ b/src/add_assign_like.rs
@@ -3,7 +3,11 @@ use proc_macro2::{Span, TokenStream};
use syn::{Data, DeriveInput, Fields, Ident};
use utils::{add_extra_ty_param_bound_op, named_to_vec, unnamed_to_vec... | 17 | 184 | 84 |
fe5a43465ac31b367cd6d20786722ac0743ef7fe | Gaëtan Cassiers | 2019-01-17T20:56:13 | Run clippy | diff --git a/src/display.rs b/src/display.rs
index b860628..4080a52 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -149,7 +149,7 @@ impl<'a, 'b> State<'a, 'b> {
Fields::Named(fields) => &fields.named,
Fields::Unnamed(fields) => &fields.unnamed,
};
- if fields.len() == 0 {
... | 1 | 7 | 5 |
3813011240592b918303a97dc45d06581d1688e8 | Emilio Cobos Álvarez | 2019-01-18T21:40:06 | Don't require a specific minor version of rustc_version.
It works fine with it hardcoded to 0.2.0, and it avoids pulling more
dependencies in https://phabricator.services.mozilla.com/D17028. | diff --git a/Cargo.toml b/Cargo.toml
index 127a597..b0107a7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,7 +29,7 @@ syn = { version = "0.15", features = ['extra-traits'] }
proc-macro2 = "0.4.19"
[build-dependencies]
-rustc_version = "0.2.2"
+rustc_version = "0.2"
[badges]
travis-ci = { repository = "JelteF/d... | 1 | 1 | 1 |
aebc92485afbe163a7b4e512f4bdc8f183dd07ce | Ryo Yamashita | 2018-11-23T11:05:26 | Add a test case to ensure `unused_variables` suppressed | diff --git a/tests/display.rs b/tests/display.rs
index 87c2e23..1b2e665 100644
--- a/tests/display.rs
+++ b/tests/display.rs
@@ -1,4 +1,4 @@
-#![allow(dead_code, unused_imports, unused_variables)]
+#![allow(dead_code, unused_imports)]
#[macro_use]
extern crate derive_more;
@@ -18,6 +18,22 @@ struct Point2D {
y... | 1 | 18 | 1 |
2260c1fea10f5ac8e00b80b163684833ba79c17e | Ryo Yamashita | 2018-11-23T10:57:01 | Suppress `unused_variables` warnings | diff --git a/src/display.rs b/src/display.rs
index 1ea3455..b860628 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -35,6 +35,7 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> Result<TokenStream> {
Ok(quote! {
impl #impl_generics #trait_path for #name #ty_generics #where_clause
{
+... | 1 | 1 | 0 |
6907f2deb026b8abedb3e47317a0204fc62a87a5 | Jelte Fennema | 2018-10-19T15:29:27 | (cargo-release) start next development iteration 0.13.1-pre | diff --git a/Cargo.toml b/Cargo.toml
index 16cd2e1..127a597 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.13.0"
+version = "0.13.1-pre"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
a62fc7faee5a3d4b0db3a14ddb1c1de31c05dfb4 | Jelte Fennema | 2018-10-19T15:29:01 | (cargo-release) version 0.13.0 | diff --git a/Cargo.toml b/Cargo.toml
index b1a55fe..16cd2e1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.12.1-pre"
+version = "0.13.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
bebdbca5586bb5bbd93196a37f2b9e726f11b20d | Jelte Fennema | 2018-10-18T20:26:39 | Add some extra tests for display | diff --git a/tests/display.rs b/tests/display.rs
index 6f9499c..87c2e23 100644
--- a/tests/display.rs
+++ b/tests/display.rs
@@ -8,7 +8,7 @@ use std::path::PathBuf;
// the derives in some way
use std::fmt::Binary;
-#[derive(Display)]
+#[derive(Display, Octal, Binary)]
struct MyInt(i32);
#[derive(Display)]
@@ -6... | 1 | 3 | 1 |
a438c55e3d2e36fc774a363da378cf46f90205d6 | Las | 2018-10-18T12:24:01 | Add test to check that Display derive fix from commit e38e43 works
I.e. checking if you can derive Display for types with
generic types that don't implement Display. | diff --git a/tests/display.rs b/tests/display.rs
index 4ed7920..6f9499c 100644
--- a/tests/display.rs
+++ b/tests/display.rs
@@ -60,6 +60,10 @@ struct UnitStruct {}
#[derive(Display)]
enum EmptyEnum {}
+#[derive(Display)]
+#[display(fmt = "Generic")]
+struct Generic<T>(T);
+
#[test]
fn check_display() {
asse... | 1 | 5 | 0 |
c6d1c2d1036cfc3ab921409102d0c8445995656d | Las | 2018-10-12T19:20:34 | Add tests from old display_derive crate to ensure backward-compatibility | diff --git a/tests/boats_display_derive.rs b/tests/boats_display_derive.rs
new file mode 100644
index 0000000..b64f75d
--- /dev/null
+++ b/tests/boats_display_derive.rs
@@ -0,0 +1,57 @@
+// The following code is from https://github.com/withoutboats/display_derive/blob/232a32ee19e262aacbd2c93be5b4ce9e89a5fc30/tests/test... | 1 | 57 | 0 |
3e59a663e5ab72ba72772a04a4c75b3f22ec473e | Las | 2018-10-12T19:10:32 | Make Display-like derives work for empty enums too | diff --git a/src/display.rs b/src/display.rs
index 6f96fef..1ea3455 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -39,6 +39,7 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> Result<TokenStream> {
fn fmt(&self, _derive_more_Display_formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Resul... | 1 | 1 | 0 |
fa84b9a43655510046310783f9fb868832a9d58b | Las | 2018-10-12T18:59:30 | Default to the name of the variant for Display-like derives
This means you can use it with variants that have 0 fields now. | diff --git a/src/display.rs b/src/display.rs
index 3842a16..6f96fef 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -29,7 +29,8 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> Result<TokenStream> {
trait_path,
trait_attr,
input,
- }.get_match_arms()?;
+ }
+ .get_match_... | 1 | 20 | 12 |
3c69cd3572a47618eac07331e07554515e972ab7 | Las | 2018-10-12T18:19:10 | Add comment about Output trait | diff --git a/src/lib.rs b/src/lib.rs
index 4c6705e..f1537c8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -206,6 +206,10 @@ mod mul_like;
mod not_like;
mod try_into;
+// This trait describes the possible return types of
+// the derives. A derive can generally be infallible and
+// return a TokenStream, or it can be f... | 1 | 4 | 0 |
72b54cdc5b771a6e5cb4a6d1c53663f1b58e5064 | Las | 2018-10-12T18:14:04 | Don't add Display-like bound to generics for Display-like derives
I hadn't thought about it at the time, but this is really inconvenient.
The following would fail to compile:
```rust
trait Trait {
fn display(&self) -> impl Display;
}
\#[derive(Display)]
\#[display(fmt = "{}", "t.display()")]
struct S<T: Trait> {
t... | diff --git a/src/display.rs b/src/display.rs
index 91a73a9..3842a16 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -5,7 +5,6 @@ use syn::{
spanned::Spanned,
Attribute, Data, DeriveInput, Fields, Lit, Meta, MetaNameValue, NestedMeta,
};
-use utils::add_extra_ty_param_bound;
/// Provides the hook to ex... | 2 | 5 | 5 |
bb6c4d4828c0321a09249dc6c27de3d1a9d09439 | Las | 2018-10-09T07:35:46 | Require at least proc-macro2 v0.4.19 | diff --git a/Cargo.toml b/Cargo.toml
index 44ef660..b1a55fe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,7 @@ proc-macro = true
[dependencies]
quote = "0.6"
syn = { version = "0.15", features = ['extra-traits'] }
-proc-macro2 = "0.4"
+proc-macro2 = "0.4.19"
[build-dependencies]
rustc_version = "0.2.2" | 1 | 1 | 1 |
5133fca1726b4ca9bef37a2a8efd80a42dee329f | Las | 2018-09-29T19:36:02 | Update from version 0.14 of syn to version 0.15 | diff --git a/Cargo.toml b/Cargo.toml
index ea8e3ac..44ef660 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,7 +25,7 @@ proc-macro = true
[dependencies]
quote = "0.6"
-syn = { version = "0.14", features = ['extra-traits'] }
+syn = { version = "0.15", features = ['extra-traits'] }
proc-macro2 = "0.4"
[build-depen... | 1 | 1 | 1 |
f3e47334b8d5d353a7ac186b0f8099e6ae261a4b | Jelte Fennema | 2018-09-19T07:06:16 | (cargo-release) start next development iteration 0.12.1-pre | diff --git a/Cargo.toml b/Cargo.toml
index 5e01602..ea8e3ac 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.12.0"
+version = "0.12.1-pre"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
4ace5aa30ca751ebe1ad3c3a0ad2580da0dc5a59 | Jelte Fennema | 2018-09-19T07:05:26 | (cargo-release) version 0.12.0 | diff --git a/Cargo.toml b/Cargo.toml
index f5aa647..5e01602 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "derive_more"
-version = "0.11.1-pre"
+version = "0.12.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT... | 1 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.