diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-03-08 19:56:53 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-03-08 19:56:53 +0100 |
commit | 6e1ef94b93eb2ff98f49771ef45f3e18373fdd5e (patch) | |
tree | 4035438045dd90a87c597112190ee378371c0e80 /askama_derive/src | |
parent | f71b2f03230fe8a6f50c3a02dcfeaed920fbdca3 (diff) | |
download | askama-6e1ef94b93eb2ff98f49771ef45f3e18373fdd5e.tar.gz askama-6e1ef94b93eb2ff98f49771ef45f3e18373fdd5e.tar.bz2 askama-6e1ef94b93eb2ff98f49771ef45f3e18373fdd5e.zip |
Use if let to better handle Option type
Diffstat (limited to '')
-rw-r--r-- | askama_derive/src/generator.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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() }; |