Skip to content

Commit 1b361d7

Browse files
bors[bot]cuviper
andauthored
Merge #29
29: Update to Rust 2018 and release 0.3.0 r=cuviper a=cuviper Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents d0a92ae + 82c32fd commit 1b361d7

File tree

9 files changed

+30
-12
lines changed

9 files changed

+30
-12
lines changed

Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ repository = "https://github.com/rust-num/num-derive"
1111
version = "0.3.0"
1212
readme = "README.md"
1313
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]
14+
edition = "2018"
1415

1516
[dependencies]
1617
proc-macro2 = "1"
@@ -28,3 +29,14 @@ full-syntax = ["syn/full"]
2829
name = "num_derive"
2930
proc-macro = true
3031
test = false
32+
33+
# Most of the tests are left implicily detected, compiled for Rust 2018,
34+
# but let's try a few of them with the old 2015 edition too.
35+
36+
[[test]]
37+
name = "newtype-2015"
38+
edition = "2015"
39+
40+
[[test]]
41+
name = "trivial-2015"
42+
edition = "2015"

RELEASES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Release 0.3.0 (2019-09-27)
2+
3+
- [Updated the `proc-macro2`, `quote`, and `syn` dependencies to 1.0][28],
4+
which raises the minimum supported rustc to 1.31.
5+
6+
[28]: https://github.com/rust-num/num-derive/pull/28
7+
18
# Release 0.2.5 (2019-04-23)
29

310
- [Improved the masking of lints in derived code][23].

src/lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

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

1515
//! Procedural macros to derive numeric traits in Rust.
@@ -21,7 +21,7 @@
2121
//! ```toml
2222
//! [dependencies]
2323
//! num-traits = "0.2"
24-
//! num-derive = "0.2"
24+
//! num-derive = "0.3"
2525
//! ```
2626
//!
2727
//! Then you can derive traits on your own types:
@@ -41,14 +41,9 @@
4141
4242
extern crate proc_macro;
4343

44-
extern crate proc_macro2;
45-
#[macro_use]
46-
extern crate quote;
47-
extern crate syn;
48-
4944
use proc_macro::TokenStream;
5045
use proc_macro2::Span;
51-
46+
use quote::quote;
5247
use syn::{Data, Fields, Ident};
5348

5449
// Within `exp`, you can bring things into scope with `extern crate`.

tests/issue-6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![deny(trivial_numeric_casts)]
2-
extern crate num;
2+
33
#[macro_use]
44
extern crate num_derive;
55

tests/issue-9.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![deny(unused_qualifications)]
2-
extern crate num;
2+
33
#[macro_use]
44
extern crate num_derive;
55
use num::FromPrimitive;

tests/newtype-2015.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Same source, just compiled for 2015 edition
2+
include!("newtype.rs");

tests/newtype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extern crate num as num_renamed;
22
#[macro_use]
33
extern crate num_derive;
44

5-
use num_renamed::{Float, FromPrimitive, Num, NumCast, One, ToPrimitive, Zero};
5+
use crate::num_renamed::{Float, FromPrimitive, Num, NumCast, One, ToPrimitive, Zero};
66
use std::ops::Neg;
77

88
#[derive(

tests/trivial-2015.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Same source, just compiled for 2015 edition
2+
include!("trivial.rs");

tests/with_custom_values.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn test_reflexive_for_enum_with_custom_value() {
6464
.map(|&x| -> Option<Color> { num_renamed::FromPrimitive::from_u64(x) })
6565
.map(|x| x.and_then(|x| num_renamed::ToPrimitive::to_u64(&x)))
6666
.collect();
67-
let before = before.into_iter().cloned().map(Some).collect::<Vec<_>>();
67+
let before = before.iter().cloned().map(Some).collect::<Vec<_>>();
6868

6969
assert_eq!(before, after);
7070
}

0 commit comments

Comments
 (0)