Skip to content

Commit cd8a697

Browse files
committed
Fix clippy warnings
1 parent 104d812 commit cd8a697

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

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)