Skip to content

Commit

Permalink
Use num-traits, and release num-derive 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Feb 21, 2018
1 parent cb67715 commit f5e6545
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ categories = [ "science" ]
license = "MIT/Apache-2.0"
name = "num-derive"
repository = "https://github.com/rust-num/num-derive"
version = "0.1.44"
version = "0.2.0"
readme = "README.md"

[dependencies]
Expand All @@ -18,9 +18,8 @@ syn = "0.12.7"

[dev-dependencies]
compiletest_rs = "0.3.5"

[dev-dependencies.num]
version = "0.1"
num-traits = "0.2"
num = "0.1"

[features]
full-syntax = ["syn/full"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
num = "0.1"
num-derive = "0.1"
num-traits = "0.2"
num-derive = "0.2"
```

and this to your crate root:
Expand Down
14 changes: 14 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
# Release 0.2.0

- [Discriminant matching is now simplified][10], casting values directly by
name, rather than trying to compute offsets from known values manually.
- **breaking change**: [Derivations now import the traits from `num-traits`][11]
instead of the full `num` crate. These are still compatible, but users need
to have an explicit `num-traits = "0.2"` dependency in their `Cargo.toml`.

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


# Release 0.1.44

- [The derived code now explicitly allows `unused_qualifications`][9], so users
that globally deny that lint don't encounter an error.

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


# Release 0.1.43

- [The derived code now explicitly allows `trivial_numeric_casts`][7], so users
that globally deny that lint don't encounter an error.

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


# Release 0.1.42

- [num-derive now has its own source repository][num-356] at [rust-num/num-derive][home].
Expand Down
10 changes: 5 additions & 5 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.1")]
#![doc(html_root_url = "https://docs.rs/num-derive/0.2")]

extern crate proc_macro;

Expand Down Expand Up @@ -59,9 +59,9 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
#[allow(non_upper_case_globals)]
#[allow(unused_qualifications)]
const #dummy_const: () = {
extern crate num as _num;
extern crate num_traits as _num_traits;

impl _num::traits::FromPrimitive for #name {
impl _num_traits::FromPrimitive for #name {
#[allow(trivial_numeric_casts)]
fn from_i64(#from_i64_var: i64) -> Option<Self> {
#(#clauses else)* {
Expand Down Expand Up @@ -124,9 +124,9 @@ pub fn to_primitive(input: TokenStream) -> TokenStream {
#[allow(non_upper_case_globals)]
#[allow(unused_qualifications)]
const #dummy_const: () = {
extern crate num as _num;
extern crate num_traits as _num_traits;

impl _num::traits::ToPrimitive for #name {
impl _num_traits::ToPrimitive for #name {
#[allow(trivial_numeric_casts)]
fn to_i64(&self) -> Option<i64> {
#match_expr
Expand Down

0 comments on commit f5e6545

Please sign in to comment.