From 6e1ef94b93eb2ff98f49771ef45f3e18373fdd5e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 8 Mar 2017 19:56:53 +0100 Subject: Use if let to better handle Option type --- askama_derive/src/generator.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 2eed03f..6f75318 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -346,8 +346,8 @@ impl<'a> Generator<'a> { let mut where_clause = Tokens::new(); ast.generics.where_clause.to_tokens(&mut where_clause); - let name = if trait_suffix.is_some() { - format!("TraitFrom{}", trait_suffix.unwrap()) + let name = if let Some(suffix) = trait_suffix { + format!("TraitFrom{}", suffix) } else { "askama::Template".to_string() }; -- cgit