Skip to content

Commit

Permalink
Merge #29
Browse files Browse the repository at this point in the history
29: Update to Rust 2018 and release 0.3.0 r=cuviper a=cuviper



Co-authored-by: Josh Stone <[email protected]>
  • Loading branch information
bors[bot] and cuviper authored Sep 27, 2019
2 parents d0a92ae + 82c32fd commit 1b361d7
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 12 deletions.
12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = "https://github.com/rust-num/num-derive"
version = "0.3.0"
readme = "README.md"
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]
edition = "2018"

[dependencies]
proc-macro2 = "1"
Expand All @@ -28,3 +29,14 @@ full-syntax = ["syn/full"]
name = "num_derive"
proc-macro = true
test = false

# Most of the tests are left implicily detected, compiled for Rust 2018,
# but let's try a few of them with the old 2015 edition too.

[[test]]
name = "newtype-2015"
edition = "2015"

[[test]]
name = "trivial-2015"
edition = "2015"
7 changes: 7 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Release 0.3.0 (2019-09-27)

- [Updated the `proc-macro2`, `quote`, and `syn` dependencies to 1.0][28],
which raises the minimum supported rustc to 1.31.

[28]: https://github.com/rust-num/num-derive/pull/28

# Release 0.2.5 (2019-04-23)

- [Improved the masking of lints in derived code][23].
Expand Down
11 changes: 3 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

#![crate_type = "proc-macro"]
#![doc(html_root_url = "https://docs.rs/num-derive/0.2")]
#![doc(html_root_url = "https://docs.rs/num-derive/0.3")]
#![recursion_limit = "512"]

//! Procedural macros to derive numeric traits in Rust.
Expand All @@ -21,7 +21,7 @@
//! ```toml
//! [dependencies]
//! num-traits = "0.2"
//! num-derive = "0.2"
//! num-derive = "0.3"
//! ```
//!
//! Then you can derive traits on your own types:
Expand All @@ -41,14 +41,9 @@

extern crate proc_macro;

extern crate proc_macro2;
#[macro_use]
extern crate quote;
extern crate syn;

use proc_macro::TokenStream;
use proc_macro2::Span;

use quote::quote;
use syn::{Data, Fields, Ident};

// Within `exp`, you can bring things into scope with `extern crate`.
Expand Down
2 changes: 1 addition & 1 deletion tests/issue-6.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![deny(trivial_numeric_casts)]
extern crate num;

#[macro_use]
extern crate num_derive;

Expand Down
2 changes: 1 addition & 1 deletion tests/issue-9.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![deny(unused_qualifications)]
extern crate num;

#[macro_use]
extern crate num_derive;
use num::FromPrimitive;
Expand Down
2 changes: 2 additions & 0 deletions tests/newtype-2015.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Same source, just compiled for 2015 edition
include!("newtype.rs");
2 changes: 1 addition & 1 deletion tests/newtype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extern crate num as num_renamed;
#[macro_use]
extern crate num_derive;

use num_renamed::{Float, FromPrimitive, Num, NumCast, One, ToPrimitive, Zero};
use crate::num_renamed::{Float, FromPrimitive, Num, NumCast, One, ToPrimitive, Zero};
use std::ops::Neg;

#[derive(
Expand Down
2 changes: 2 additions & 0 deletions tests/trivial-2015.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Same source, just compiled for 2015 edition
include!("trivial.rs");
2 changes: 1 addition & 1 deletion tests/with_custom_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn test_reflexive_for_enum_with_custom_value() {
.map(|&x| -> Option<Color> { num_renamed::FromPrimitive::from_u64(x) })
.map(|x| x.and_then(|x| num_renamed::ToPrimitive::to_u64(&x)))
.collect();
let before = before.into_iter().cloned().map(Some).collect::<Vec<_>>();
let before = before.iter().cloned().map(Some).collect::<Vec<_>>();

assert_eq!(before, after);
}

0 comments on commit 1b361d7

Please sign in to comment.