Fix clippy warnings in identifiers and events-macros

This commit is contained in:
Devin R 2020-07-23 08:04:44 -04:00 committed by Jonas Platte
parent 56ff7c05e9
commit 3329dc7345
2 changed files with 4 additions and 3 deletions

View File

@ -10,8 +10,9 @@ use crate::event_parse::{to_kind_variation, EventKindVariation};
pub fn expand_event(input: DeriveInput) -> syn::Result<TokenStream> {
let ident = &input.ident;
let (_kind, var) = to_kind_variation(ident)
.ok_or(syn::Error::new(Span::call_site(), "not a valid ruma event struct identifier"))?;
let (_kind, var) = to_kind_variation(ident).ok_or_else(|| {
syn::Error::new(Span::call_site(), "not a valid ruma event struct identifier")
})?;
let (impl_gen, ty_gen, where_clause) = input.generics.split_for_impl();
let is_generic = !input.generics.params.is_empty();

View File

@ -390,7 +390,7 @@ mod tests {
let deserialized =
from_str::<RoomVersionId>(r#""1""#).expect("Failed to convert RoomVersionId to JSON.");
assert_matches!(deserialized, RoomVersionId::Version1);
assert_eq!(deserialized, RoomVersionId::Version1);
assert!(deserialized.is_official());
assert_eq!(