Fix clippy lints in agb-entry

This commit is contained in:
Gwilym Kuiper 2021-08-07 16:51:14 +01:00
parent bcfc8e506c
commit 1241896177

View file

@ -4,7 +4,6 @@ use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::quote;
use syn::{ItemFn, ReturnType, Type, Visibility, Ident};
use rand;
use rand::Rng;
#[proc_macro_attribute]
@ -20,10 +19,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
&& f.sig.generics.params.is_empty()
&& f.sig.generics.where_clause.is_none()
&& match f.sig.output {
ReturnType::Type(_, ref ty) => match **ty {
Type::Never(_) => true,
_ => false,
},
ReturnType::Type(_, ref ty) => matches!(**ty, Type::Never(_)),
_ => false,
},
"#[agb::entry] must have signature [unsafe] fn () -> !"
@ -50,9 +46,9 @@ fn random_ident() -> Ident {
Ident::new(
&(0..16).map(|i| {
if i == 0 || rng.gen() {
('a' as u8 + rng.gen::<u8>() % 25) as char
(b'a' + rng.gen::<u8>() % 25) as char
} else {
('0' as u8 + rng.gen::<u8>() % 10) as char
(b'0' + rng.gen::<u8>() % 10) as char
}
}).collect::<String>(),
Span::call_site()