Skip to content

Commit

Permalink
Merge #24
Browse files Browse the repository at this point in the history
24: Release 0.2.5 r=cuviper a=cuviper



Co-authored-by: Josh Stone <[email protected]>
  • Loading branch information
bors[bot] and cuviper committed Apr 23, 2019
2 parents 104d812 + 9eb97a3 commit 23d979c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 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.2.4"
version = "0.2.5"
readme = "README.md"
build = "build.rs"
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]
Expand Down
6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Release 0.2.5 (2019-04-23)

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

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

# Release 0.2.4 (2019-01-25)

- [Adjusted dependencies to allow no-std targets][22].
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ fn unraw(ident: &proc_macro2::Ident) -> String {

// If `data` is a newtype, return the type it's wrapping.
fn newtype_inner(data: &syn::Data) -> Option<syn::Type> {
match data {
&Data::Struct(ref s) => {
match *data {
Data::Struct(ref s) => {
match s.fields {
Fields::Unnamed(ref fs) => {
if fs.unnamed.len() == 1 {
Expand Down Expand Up @@ -452,6 +452,8 @@ pub fn to_primitive(input: TokenStream) -> TokenStream {
dummy_const_trick("ToPrimitive", &name, impl_).into()
}

#[allow(renamed_and_removed_lints)]
#[cfg_attr(feature = "cargo-clippy", allow(const_static_lifetime))]
const NEWTYPE_ONLY: &'static str = "This trait can only be derived for newtypes";

/// Derives [`num_traits::NumOps`][num_ops] for newtypes. The inner type must already implement
Expand Down
2 changes: 1 addition & 1 deletion tests/newtype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn test_from_primitive() {
fn test_from_primitive_128() {
assert_eq!(
MyFloat::from_i128(std::i128::MIN),
Some(MyFloat(-2.0.powi(127)))
Some(MyFloat((-2.0).powi(127)))
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/trivial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn test_reflexive_for_trivial_case() {
.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 23d979c

Please sign in to comment.