Skip to content

Commit 23d979c

Browse files
bors[bot]cuviper
andcommitted
Merge #24
24: Release 0.2.5 r=cuviper a=cuviper Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents 104d812 + 9eb97a3 commit 23d979c

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ categories = [ "science" ]
88
license = "MIT/Apache-2.0"
99
name = "num-derive"
1010
repository = "https://github.com/rust-num/num-derive"
11-
version = "0.2.4"
11+
version = "0.2.5"
1212
readme = "README.md"
1313
build = "build.rs"
1414
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]

RELEASES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Release 0.2.5 (2019-04-23)
2+
3+
- [Improved the masking of lints in derived code][23].
4+
5+
[23]: https://github.com/rust-num/num-derive/pull/23
6+
17
# Release 0.2.4 (2019-01-25)
28

39
- [Adjusted dependencies to allow no-std targets][22].

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ fn unraw(ident: &proc_macro2::Ident) -> String {
9999

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

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

457459
/// Derives [`num_traits::NumOps`][num_ops] for newtypes. The inner type must already implement

tests/newtype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn test_from_primitive() {
3939
fn test_from_primitive_128() {
4040
assert_eq!(
4141
MyFloat::from_i128(std::i128::MIN),
42-
Some(MyFloat(-2.0.powi(127)))
42+
Some(MyFloat((-2.0).powi(127)))
4343
);
4444
}
4545

tests/trivial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn test_reflexive_for_trivial_case() {
5858
.map(|&x| -> Option<Color> { num_renamed::FromPrimitive::from_u64(x) })
5959
.map(|x| x.and_then(|x| num_renamed::ToPrimitive::to_u64(&x)))
6060
.collect();
61-
let before = before.into_iter().cloned().map(Some).collect::<Vec<_>>();
61+
let before = before.iter().cloned().map(Some).collect::<Vec<_>>();
6262

6363
assert_eq!(before, after);
6464
}

0 commit comments

Comments
 (0)