Skip to content

Commit

Permalink
Update darling, quote, proc-macro2, syn (#148)
Browse files Browse the repository at this point in the history
* Update darling, quote, proc-macro2, syn
* Increase rustc min version to 1.37.0
  • Loading branch information
spearman authored and TedDriggs committed Sep 30, 2019
1 parent fb50479 commit 67c9c95
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rust:
- beta
- stable
- nightly
- 1.18.0
- 1.37.0
matrix:
include:
- rust: nightly
Expand Down
5 changes: 5 additions & 0 deletions derive_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.8.0] - 2019-09-30
- Increase dependency versions to latest #148
- Requires Rust 1.37.0 or newer (was 1.18.0) #148
- Increase version of derive_builder_core crate to match crate's public interface

## [0.7.2] - 2019-05-22
- Add `strip_option` flag for setter #116

Expand Down
14 changes: 7 additions & 7 deletions derive_builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "derive_builder"
version = "0.7.2"
version = "0.8.0"
authors = ["Colin Kiegel <kiegel@gmx.de>",
"Pascal Hertleif <killercup@gmail.com>",
"Jan-Erik Rediger <janerik@fnordig.de>",
"Ted Driggs <ted.driggs@outlook.com>"]

description = "Rust macro to automatically implement the builder pattern for arbitrary structs."
repository = "https://github.com/colin-kiegel/rust-derive-builder"
documentation = "https://docs.rs/derive_builder/0.7.2"
documentation = "https://docs.rs/derive_builder/0.8.0"

license = "MIT/Apache-2.0"
categories = ["development-tools", "rust-patterns"]
Expand All @@ -28,17 +28,17 @@ skeptic_tests = ["skeptic"]
nightlytests = ["compiletest_rs"]

[dependencies]
darling = "0.9"
proc-macro2 = "0.4"
quote = "0.6"
darling = "0.10"
proc-macro2 = "1.0"
quote = "1.0"
log = { version = "0.4", optional = true }
env_logger = { version = "0.5", optional = true }
derive_builder_core = { version = "=0.5.0", path = "../derive_builder_core" }
derive_builder_core = { version = "=0.8.0", path = "../derive_builder_core" }
skeptic = { version = "0.13", optional = true }
compiletest_rs = { version = "0.3.18", optional = true }

[dependencies.syn]
version = "0.15"
version = "1.0"
features = ["full", "extra-traits"]

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion derive_builder/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build status](https://travis-ci.org/colin-kiegel/rust-derive-builder.svg?branch=master)](https://travis-ci.org/colin-kiegel/rust-derive-builder)
[![Rust version]( https://img.shields.io/badge/rust-1.18+-blue.svg)]()
[![Rust version]( https://img.shields.io/badge/rust-1.37+-blue.svg)]()
[![Documentation](https://docs.rs/derive_builder/badge.svg)](https://docs.rs/derive_builder)
[![Latest version](https://img.shields.io/crates/v/derive_builder.svg)](https://crates.io/crates/derive_builder)
[![All downloads](https://img.shields.io/crates/d/derive_builder.svg)](https://crates.io/crates/derive_builder)
Expand Down
6 changes: 3 additions & 3 deletions derive_builder/src/options/darling_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::vec::IntoIter;

use derive_builder_core::BuildMethod;

use darling::util::{Flag, IdentList};
use darling::util::{Flag, PathList};
use darling::{self, FromMeta};
use syn::{self, Attribute, Generics, Ident, Path, Visibility};
use proc_macro2::Span;
Expand Down Expand Up @@ -165,7 +165,7 @@ impl FromMeta for FieldSetterMeta {
}

fn from_meta(value: &syn::Meta) -> darling::Result<Self> {
if let syn::Meta::Word(_) = *value {
if let syn::Meta::Path(_) = *value {
FieldSetterMeta::from_word()
} else {
FieldLevelSetter::from_meta(value).map(FieldSetterMeta::Longhand)
Expand Down Expand Up @@ -244,7 +244,7 @@ pub struct Options {

/// Additional traits to derive on the builder.
#[darling(default)]
derive: IdentList,
derive: PathList,

/// Setter options applied to all field setters in the struct.
#[darling(default)]
Expand Down
10 changes: 5 additions & 5 deletions derive_builder_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "derive_builder_core"
version = "0.5.0"
version = "0.8.0"
authors = ["Colin Kiegel <kiegel@gmx.de>",
"Pascal Hertleif <killercup@gmail.com>",
"Jan-Erik Rediger <janerik@fnordig.de>",
Expand All @@ -20,10 +20,10 @@ logging = [ "log" ]
travis-ci = { repository = "colin-kiegel/rust-derive-builder" }

[dependencies]
darling = "0.9"
proc-macro2 = "0.4"
quote = "0.6"
syn = { version = "0.15", features = ["full", "extra-traits"] }
darling = "0.10"
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ["full", "extra-traits"] }
log = { version = "0.4", optional = true }

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions derive_builder_core/src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use quote::{ToTokens, TokenStreamExt};
use proc_macro2::TokenStream;
use syn::punctuated::Punctuated;
use syn::{self, Ident, TraitBound, TraitBoundModifier, TypeParamBound};
use syn::{self, Path, TraitBound, TraitBoundModifier, TypeParamBound};

use doc_comment::doc_comment_from;
use Bindings;
Expand Down Expand Up @@ -52,7 +52,7 @@ pub struct Builder<'a> {
/// Pattern of this builder struct.
pub pattern: BuilderPattern,
/// Traits to automatically derive on the builder type.
pub derives: &'a [syn::Ident],
pub derives: &'a [Path],
/// Type parameters and lifetimes attached to this builder's struct
/// definition.
pub generics: Option<&'a syn::Generics>,
Expand Down Expand Up @@ -95,10 +95,10 @@ impl<'a> ToTokens for Builder<'a> {

// Create the comma-separated set of derived traits for the builder
let derived_traits = {
let default_trait: Ident = parse_quote!(Default);
let clone_trait: Ident = parse_quote!(Clone);
let default_trait: Path = parse_quote!(Default);
let clone_trait: Path = parse_quote!(Clone);

let mut traits: Punctuated<&Ident, Token![,]> = Default::default();
let mut traits: Punctuated<&Path, Token![,]> = Default::default();
traits.push(&default_trait);

if self.must_derive_clone {
Expand Down Expand Up @@ -344,7 +344,7 @@ mod tests {

#[test]
fn add_derives() {
let derives = vec![syn::Ident::new("Serialize", ::proc_macro2::Span::call_site()),];
let derives = vec![syn::parse_str("Serialize").unwrap(),];
let mut builder = default_builder!();
builder.derives = &derives;

Expand Down
4 changes: 2 additions & 2 deletions derive_builder_core/src/setter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ fn extract_type_from_option(ty: &syn::Type) -> Option<&syn::Type> {
]
.into_iter()
.find(|s| &idents_of_path == *s)
.and_then(|_| path.segments.last())
.and_then(|_| path.segments.last().map(Pair::End))
}

extract_type_path(ty)
Expand All @@ -213,7 +213,7 @@ fn extract_type_from_option(ty: &syn::Type) -> Option<&syn::Type> {
_ => None,
}
})
.and_then(|generic_arg| match *generic_arg.into_value() {
.and_then(|generic_arg| match *generic_arg {
GenericArgument::Type(ref ty) => Some(ty),
_ => None,
})
Expand Down

0 comments on commit 67c9c95

Please sign in to comment.